How shonsagoro/valoration_microservice_onwork works
• Client/API Gateway: Although not explicitly shown as a separate frontend, assume clients will communicate with the system via exposed API endpoints.
• Middleware (JWT Middleware): A component that intercepts requests to handle authentication.
• Publication Management Service:
• Application Layer: Contains DTOs (both request and response), mappers, and use cases.
• Domain Layer: Contains core entities (e.g., publication and comment) and domain ports (interfaces).
• Infrastructure Layer: Contains controllers, endpoints, DAOs, mappers for data translation, repository implementations (MongoDB repositories), S3 image upload service, and dependency configurations.
• Reviews Management Service:
• Similarly organized with its own application, domain, and infrastructure layers.
• Contains DTOs, use cases (for creation, deletion, update, and fetching of valorations), domain entities (such as valoration and comment), and infrastructure details like controllers, endpoints, DAOs, repositories, and attached S3 image upload functionality.
• Database: MongoDB is used (shown in src/database/mongodb.py and interacting with repositories).
• External resources: S3 service for image uploads that is integrated into both the publication and reviews management infrastructures.
Displaying Relationships and Interactions
• From the middleware, show traffic splitting into the two main services:
• Requests related to publications (creating, updating, listing, or deleting publications/comments) are handled by the Publication Management Service.
• Requests concerning reviews/valorations are handled by the Reviews Management Service.
• Within each service, illustrate:
• A flow from the “endpoint” (exposed API routes/controllers) to the “application layer” where use cases are invoked.
• Interaction between the application layer and the domain layer (with entities and business rules).
• The application layer reaching out to the infrastructure layer for persistence (via repository interfaces and their MongoDB implementations) and external services (like S3 uploads).
• That both services communicate with the MongoDB database (depicted as a shared resource or as separate containers if they are intended to be independent).
Architectural Patterns and Design Principles
• Separation of concerns through the layered (or clean) architecture: clearly demarcate the application, domain, and infrastructure layers.
• Dependency inversion: domain ports (interfaces) in both services abstract away the infrastructure details, enabling the use of specific implementations that interact with MongoDB.
• Microservices principle: both Publication Management and Reviews Management are designed as standalone modules, maintaining isolation while sharing common middleware and database access.
• API controllers and endpoint routing to underscore the RESTful design pattern.
Relevant Technologies and Frameworks
• Python (as evident from the file types and project structure).
• MongoDB (for data storage).
• JWT for user authentication in the middleware.
• AWS S3 (for image uploads in both modules).
• Docker (containerization of the application).