new api service and logic implemented
This commit is contained in:
203
docs/architecture/system_architecture.md
Normal file
203
docs/architecture/system_architecture.md
Normal file
@@ -0,0 +1,203 @@
|
||||
# System Architecture
|
||||
|
||||
## Core Services
|
||||
|
||||
### Top-Level Services
|
||||
1. **AuthServiceApi**
|
||||
- User authentication and authorization
|
||||
- Token management
|
||||
- Permission handling
|
||||
|
||||
2. **EventServiceApi**
|
||||
- Event processing and management
|
||||
- Event routing and handling
|
||||
- Event validation
|
||||
|
||||
3. **ValidationServiceApi**
|
||||
- Input validation
|
||||
- Data verification
|
||||
- Schema validation
|
||||
|
||||
## System Components
|
||||
|
||||
### AllConfigs
|
||||
Configuration management for various system components.
|
||||
|
||||
| Category | Context | Dependencies |
|
||||
|----------|----------|--------------|
|
||||
| Email | configs, email_send_model | - |
|
||||
| NoSqlDatabase | configs | - |
|
||||
| Redis | configs | - |
|
||||
| SqlDatabase | configs | - |
|
||||
| Token | configs | - |
|
||||
|
||||
### Schemas
|
||||
- SQL Alchemy schema definitions
|
||||
- Data models and relationships
|
||||
- Database structure definitions
|
||||
|
||||
### ApiLibrary
|
||||
|
||||
| Category | Description |
|
||||
|----------|-------------|
|
||||
| common | Error line number tracking |
|
||||
| date_time_actions | DateTime handling functions |
|
||||
| extensions | Password module and utilities |
|
||||
|
||||
### ApiServices
|
||||
|
||||
| Category | Context | Dependencies |
|
||||
|----------|----------|--------------|
|
||||
| Login | UserLoginModule | ApiLibrary, Schemas, ErrorHandlers, ApiValidations, ApiServices |
|
||||
| Token | TokenService | Services, Schemas, ApiLibrary, ErrorHandlers, AllConfigs, ApiValidations |
|
||||
|
||||
### Services
|
||||
|
||||
| Category | Dependencies |
|
||||
|----------|--------------|
|
||||
| Email | ApiLibrary, Schemas, ErrorHandlers, ApiValidations, ApiServices |
|
||||
| MongoDb | - |
|
||||
| PostgresDb | - |
|
||||
| Redis | - |
|
||||
|
||||
### ErrorHandlers
|
||||
- ErrorHandlers: General error handling
|
||||
- Exceptions: Custom exception definitions
|
||||
|
||||
### LanguageModels
|
||||
- Database: Database-related language models
|
||||
- Errors: Error message translations
|
||||
|
||||
### ApiValidations
|
||||
- Custom: Custom validation rules
|
||||
- Request: Request validation logic
|
||||
|
||||
## Testing Framework
|
||||
|
||||
### Test Categories
|
||||
- AlchemyResponse pagination testing
|
||||
- Redis function testing
|
||||
- MongoDB function testing
|
||||
- Validation testing
|
||||
- Header testing
|
||||
- Auth function testing
|
||||
- Language testing
|
||||
- Property definition testing
|
||||
- SmartQuery testing
|
||||
|
||||
### Error Categories
|
||||
- AlchemyError
|
||||
- ApiError
|
||||
- RedisError
|
||||
- MongoError
|
||||
- EmailError
|
||||
- Validation[Pydantic]
|
||||
|
||||
## Alchemy Implementation Phases
|
||||
|
||||
1. **BaseAlchemyNeed**
|
||||
- Session management
|
||||
- Core functionality
|
||||
|
||||
2. **PlainModel**
|
||||
- Basic model implementation
|
||||
|
||||
3. **FilteredModel**
|
||||
- Filter functionality
|
||||
|
||||
4. **PaginatedModel**
|
||||
- Pagination attributes
|
||||
- Filter integration
|
||||
|
||||
5. **LanguageModel**
|
||||
- Function retrieval
|
||||
- Header management
|
||||
|
||||
6. **ResponseModel**
|
||||
- Plain AlchemyClass
|
||||
- Dictionary conversion
|
||||
- Multiple response handling
|
||||
|
||||
## System Layers
|
||||
|
||||
1. **DependenciesLayer**
|
||||
- External dependencies
|
||||
- System requirements
|
||||
|
||||
2. **ApplicationLayer**
|
||||
- Core application logic
|
||||
- Business rules
|
||||
|
||||
3. **ServiceLayer**
|
||||
- Service implementations
|
||||
- API endpoints
|
||||
|
||||
4. **TestLayer**
|
||||
- Test suites
|
||||
- Test utilities
|
||||
|
||||
5. **DevLayer**
|
||||
- Development tools
|
||||
- Debug utilities
|
||||
|
||||
6. **RootLayer**
|
||||
- Main directory
|
||||
- Configuration files
|
||||
- Documentation
|
||||
|
||||
## TODO Items
|
||||
|
||||
1. **Event Directory Structure**
|
||||
- Move to ApiEvents
|
||||
- Docker file integration
|
||||
- Import organization
|
||||
|
||||
2. **MethodToEvent Renewal**
|
||||
- Update implementation
|
||||
- Improve flexibility
|
||||
|
||||
3. **Endpoint Configuration**
|
||||
- Remove unnecessary fields
|
||||
- Streamline configuration
|
||||
|
||||
4. **Middleware Organization**
|
||||
- Consolidate into /TokenEventMiddleware/
|
||||
- Standardize naming
|
||||
|
||||
5. **Code Cleanup**
|
||||
- Remove ActionsSchemaFactory
|
||||
- Remove ActionsSchema
|
||||
- Move endpoint_wrapper to Middleware.wrappers
|
||||
|
||||
6. **Function Organization**
|
||||
- Support sync/async functions
|
||||
- Improve API function organization
|
||||
|
||||
7. **Directory Structure**
|
||||
- Consolidate AllConfigs, ApiLibrary, ErrorHandlers
|
||||
- Move to RootLayer
|
||||
|
||||
8. **Configuration Management**
|
||||
- Update RouteFactoryConfig
|
||||
- Update EndpointFactoryConfig
|
||||
- Implement event validation interface
|
||||
|
||||
9. **Language Model**
|
||||
- Review Schemas.__language_model__
|
||||
- Update implementation
|
||||
|
||||
10. **Service Container**
|
||||
- Review ApiServices
|
||||
- Plan container migration
|
||||
|
||||
11. **Language Defaults**
|
||||
- Add to config
|
||||
- Implement ["tr", "en"] as default
|
||||
|
||||
## Notes
|
||||
|
||||
- Redis implementation needs RedisRow class
|
||||
- Event validation needs database integration
|
||||
- Consider containerization for ApiServices
|
||||
- Review language model implementation
|
||||
- Test coverage needs improvement
|
||||
Reference in New Issue
Block a user