How capstone-rhcqs/rhcqs_be works
Main Components
• API Controllers (found in the “RHCQS_BE/Controllers” folder): These serve as entry points for the various functionalities such as account handling, quotation processing, chat, notifications, file uploads, etc.
• Middleware Components (e.g., ExceptionHandlingMiddleware, AuthorizationHandlingMiddleware): These are crucial for handling cross-cutting concerns like authentication and error management.
• SignalR Hub (RHCQS_BE/Hubs): Particularly the ChatHub that manages real-time chat features.
• Business Objects (RHCQS_BusinessObject): Houses domain objects, payloads (both request and response DTOs), helpers, and pagination utilities.
• Data Access Layer (RHCQS_DataAccessObjects): Consists of database context (RhcqsContext) and model classes that map to SQL Server entities.
• Repository Layer (RHCQS_Repositories): Implements the repository and unit-of-work patterns to provide a decoupled data access API.
• Service Layer (RHCQS_Services): Contains business logic implementations for managing accounts, tasks, quotations, projects, chat, and integrations with external services like Cloudinary and Firebase.
• External Integrations: Third-party libraries and integrations (Cloudinary, Firebase, Mail) that are used to support features like file uploading, notifications, or real-time messaging.
Relationships and Interactions
• Clients (web or mobile) send requests to API Controllers.
• Controllers call Service interfaces to process business logic.
• Services use Repository interfaces to interact with the Data Access Layer and perform CRUD operations on the SQL Server.
• The Repository layer interacts with Entity Framework (as suggested by the use of models and context) to communicate with the database.
• Middleware components intercept incoming requests to handle errors, authentication, and authorization.
• SignalR Hubs manage real-time communications, particularly for chat functions.
• External services are integrated within the service layer (e.g., GmailSenderService for emails, FirebaseService for notifications) to handle external communication needs.
Architectural Patterns and Design Principles Highlighted
• Layered Architecture / N-tier: Clear separations among Controller (presentation), Service (business logic), Repository (data access), and Data Models.
• MVC / API-based Design: The Controllers are dedicated to handling HTTP routes, likely following RESTful API standards.
• Dependency Injection: Evident from the extensive separation of interfaces and implementation (e.g., in Services and Repositories).
• Use of Repository and Unit of Work patterns ensures data consistency and decoupling of the data access logic from business logic.