Skip to content

Commit b463585

Browse files
update docs
1 parent 360dd5f commit b463585

4 files changed

Lines changed: 350 additions & 403 deletions

File tree

docs/api_reference/configs.md

Lines changed: 20 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,99 +5,57 @@
55
The configs module provides tools for standardized configuration management and injection, supporting consistent setup
66
across services like databases, Redis, and email.
77

8-
## Installation
9-
10-
This module is included in the base ArchiPy installation:
11-
12-
```bash
13-
# Add ArchiPy to your project
14-
poetry add archipy
15-
```
16-
17-
## Source Code
18-
19-
📁 Location: `archipy/configs/`
20-
21-
🔗 [Browse Source](https://github.com/SyntaxArc/ArchiPy/tree/master/archipy/configs)
22-
23-
## API Stability
24-
25-
| Component | Status | Notes |
26-
|-------------------|-----------|------------------|
27-
| BaseConfig | 🟢 Stable | Production-ready |
28-
| Config Templates | 🟢 Stable | Production-ready |
29-
| Environment Types | 🟢 Stable | Production-ready |
30-
31-
## Examples
32-
33-
For practical examples, see the [Configuration Management Guide](../examples/config_management.md).
34-
35-
## Configuration Classes
36-
37-
### Base Config
38-
39-
Documentation for `archipy.configs.base_config` module.
8+
## Quick Start
409

4110
```python
4211
from archipy.configs.base_config import BaseConfig
4312

4413
class AppConfig(BaseConfig):
4514
APP_NAME: str = "MyService"
4615
DEBUG: bool = False
47-
48-
# Database settings
4916
DB_HOST: str = "localhost"
5017
DB_PORT: int = 5432
5118
```
5219

53-
*Includes all members, undocumented members, and shows inheritance.*
54-
55-
### Config Templates
56-
57-
Documentation for `archipy.configs.config_template` module.
58-
59-
```python
60-
from archipy.configs.config_template import SQLAlchemyConfig
61-
62-
class DatabaseConfig(SQLAlchemyConfig):
63-
DB_POOL_SIZE: int = 5
64-
DB_POOL_TIMEOUT: int = 30
65-
```
20+
## API Stability
6621

67-
*Includes all members, undocumented members, and shows inheritance.*
22+
| Component | Status | Notes |
23+
|-------------------|-----------|------------------|
24+
| BaseConfig | 🟢 Stable | Production-ready |
25+
| Config Templates | 🟢 Stable | Production-ready |
26+
| Environment Types | 🟢 Stable | Production-ready |
6827

69-
## Key Classes
28+
## Core Classes
7029

7130
### BaseConfig
7231

73-
Class: `archipy.configs.base_config.BaseConfig`
74-
75-
Configures:
32+
The main configuration class that provides environment variable support, type validation, and global configuration access.
7633

34+
**Key Features:**
7735
- Environment variable support
7836
- Type validation
7937
- Global configuration access
8038
- Nested configuration support
8139

82-
*Includes all members, undocumented members, and shows inheritance.*
83-
8440
### SQLAlchemyConfig
8541

86-
Class: `archipy.configs.config_template.SQLAlchemyConfig`
87-
88-
Configures:
42+
Database configuration template with connection settings, pool configuration, and debug options.
8943

44+
**Key Features:**
9045
- Database connection settings
9146
- Pool configuration
9247
- Migration settings
9348
- Debug options
9449

95-
Attributes:
50+
## Examples
9651

97-
- `DATABASE`: Database name
98-
- `DRIVER_NAME`: Database driver name
99-
- `ECHO`: Whether to log SQL statements
100-
- `ECHO_POOL`: Whether to log connection pool events
52+
For practical examples, see the [Configuration Management Guide](../examples/config_management.md).
53+
54+
## Source Code
55+
56+
📁 Location: `archipy/configs/`
57+
58+
🔗 [Browse Source](https://github.com/SyntaxArc/ArchiPy/tree/master/archipy/configs)
10159
- `ENABLE_FROM_LINTING`: Whether to enable SQL linting
10260
- `HIDE_PARAMETERS`: Whether to hide SQL parameters in logs
10361
- `HOST`: Database host

docs/api_reference/models.md

Lines changed: 42 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -3,101 +3,71 @@
33
The `models` module provides core data structures and types used throughout the application, following clean
44
architecture principles.
55

6-
## DTOs (Data Transfer Objects)
7-
8-
### Base DTOs
9-
10-
Base classes for all DTOs with common functionality.
6+
## Quick Start
117

128
```python
139
from archipy.models.dtos.base_dtos import BaseDTO
14-
from pydantic import BaseModel
10+
from archipy.models.entities.sqlalchemy.base_entities import BaseEntity
1511

12+
# Create a DTO
1613
class UserDTO(BaseDTO):
1714
id: str
1815
username: str
1916
email: str
20-
created_at: datetime
21-
```
22-
23-
::: archipy.models.dtos.base_dtos
24-
options:
25-
show_root_heading: true
26-
show_source: true
27-
28-
### Protobuf DTOs
2917

30-
Base class for DTOs that can be converted to and from Google Protocol Buffer messages.
31-
32-
```python
33-
from archipy.models.dtos.base_protobuf_dto import BaseProtobufDTO
34-
from google.protobuf.message import Message
35-
36-
class UserProtobufDTO(BaseProtobufDTO):
37-
_proto_class = UserProto # Your protobuf message class
38-
39-
id: str
18+
# Create an entity
19+
class User(BaseEntity):
20+
__tablename__ = "users"
4021
username: str
4122
email: str
42-
43-
# Convert from protobuf to DTO
44-
user_dto = UserProtobufDTO.from_proto(protobuf_message)
45-
46-
# Convert DTO to protobuf
47-
protobuf_message = user_dto.to_proto()
4823
```
4924

50-
::: archipy.models.dtos.base_protobuf_dto
51-
options:
52-
show_root_heading: true
53-
show_source: true
54-
55-
### Email DTOs
56-
57-
DTOs for email-related operations.
58-
59-
```python
60-
from archipy.models.dtos.email_dtos import EmailAttachmentDTO
25+
## Core Components
6126

62-
attachment = EmailAttachmentDTO(
63-
filename="document.pdf",
64-
content_type="application/pdf",
65-
content=b"..."
66-
)
67-
```
68-
69-
::: archipy.models.dtos.email_dtos
70-
options:
71-
show_root_heading: true
72-
show_source: true
27+
### DTOs (Data Transfer Objects)
7328

74-
### Error DTOs
29+
**Base DTOs** - Base classes for all DTOs with common functionality
30+
**Protobuf DTOs** - DTOs that can be converted to/from Google Protocol Buffer messages
31+
**Email DTOs** - DTOs for email-related operations
32+
**Error DTOs** - Standardized error response format
33+
**Pagination DTO** - Handles pagination parameters for queries
34+
**Range DTOs** - Handles range-based queries (integer, date, datetime)
35+
**Search Input DTO** - Standardized search input format
36+
**Sort DTO** - Handles sorting parameters
7537

76-
Standardized error response format.
38+
### Entities
7739

78-
```python
79-
from archipy.models.dtos.error_dto import ErrorDetailDTO
40+
**Base Entities** - Base classes for SQLAlchemy entities with common functionality
41+
**Update Tracking** - Entities with automatic update timestamp tracking
42+
**Soft Deletion** - Entities with soft deletion support
43+
**Admin Tracking** - Entities with admin user tracking
44+
**Manager Tracking** - Entities with manager user tracking
8045

81-
error = ErrorDetailDTO(
82-
code="USER_NOT_FOUND",
83-
message_en="User not found",
84-
)
85-
```
46+
### Errors
8647

87-
::: archipy.models.dtos.error_dto
88-
options:
89-
show_root_heading: true
90-
show_source: true
48+
**Base Error** - Base class for all custom exceptions
49+
**Auth Errors** - Authentication and authorization errors
50+
**Business Errors** - Business logic violation errors
51+
**Database Errors** - Database operation errors
52+
**Network Errors** - Network communication errors
53+
**Resource Errors** - Resource not found or access errors
54+
**System Errors** - System-level errors
55+
**Validation Errors** - Data validation errors
9156

92-
### Pagination DTO
57+
### Types
9358

94-
Handles pagination parameters for queries.
59+
**Base Types** - Common type definitions
60+
**Email Types** - Email-related type definitions
61+
**Error Message Types** - Error message type definitions
62+
**Language Type** - Language enumeration
63+
**Sort Order Type** - Sort order enumeration
64+
**Time Interval Unit Type** - Time interval unit enumeration
9565

96-
```python
97-
from archipy.models.dtos.pagination_dto import PaginationDTO
66+
## Examples
9867

99-
pagination = PaginationDTO(
100-
page=1,
68+
For detailed examples, see:
69+
- [Protobuf DTOs](../examples/models/protobuf_dtos.md)
70+
- [Error Handling](../examples/error_handling.md)
10171
page_size=10,
10272
total_items=100
10373
)

mkdocs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ nav:
121121
- Keycloak: examples/adapters/keycloak.md
122122
- MinIO: examples/adapters/minio.md
123123
- Kafka: examples/adapters/kafka.md
124+
- Payment Gateways: examples/adapters/parsian_payment.md
124125
- Helpers:
125126
- Overview: examples/helpers/index.md
126127
- Decorators: examples/helpers/decorators.md
@@ -129,6 +130,9 @@ nav:
129130
- Utils: examples/helpers/utils.md
130131
- Configuration: examples/config_management.md
131132
- Testing: examples/bdd_testing.md
133+
- Error Handling: examples/error_handling.md
134+
- Models:
135+
- Protobuf DTOs: examples/models/protobuf_dtos.md
132136
- Changelog: changelog.md
133137
- Contributing: contributing.md
134138
- Architecture: architecture.md

0 commit comments

Comments
 (0)