How khoahd7621/prn231-group-project works
Project Type and Overall Purpose
• This is a full-stack salary management application designed for an IT company. It handles core business processes such as employee management, contracts, timekeeping (attendance), leaves, and payroll.
• The backend is built using .NET Core 7 and ASP.NET Core Web API (with OData and JWT authentication) while the frontend is built using ReactJS with TypeScript, Vite, and Redux Toolkit. A SQL script in the Resources folder suggests the use of Microsoft SQL Server as the database.
Main Components
a. Backend:
• Business Layer: Contains business objects (e.g., Attendance, Employee, Contract, Payroll, Position, TakeLeave, Level) and Entity Framework (migrations, DbContext) for data persistence.
• Data Access Layer: Consists of specific DAO (Data Access Objects) files for accessing data for each business object.
• Data Transfer Layer: Contains Request and Response DTOs. These ensure proper communication between backend and client.
• Repositories: Implements repository patterns (with interfaces and implementations) to abstract database operations. This layer often includes helper classes and base repositories.
• Web API Layer: Controllers (for Attendance, Authentication, Contract, etc.) present RESTful endpoints and configurations (e.g., AutoMapperConfiguration). They serve as the entry point for client requests.
• Configuration/Authentication: Leverages JWT authentication and OData, and there is a configuration folder to set up mapping and possibly service registration.
b. Frontend:
• Main Application Shell: This includes index.html, main.tsx, and routing configuration files that bootstrap the React application.
• Modules: Organized by feature area (attendance, authentication, contract, dashboard, employee, leave, level, payroll, position). Each module further divides into APIs, components, and models which follow a consistent structure.
• State Management: Redux slices for authentication and profile management.
• Layouts: Default and secondary layouts are provided to route or display content based on the type of user (Admin or Employee).
• Styling and Assets: Includes CSS/SCSS, fonts, and public assets which set up the theme consistent with Ant Design.
c. Database:
• A SQL script in the Resources folder indicates that the project uses Microsoft SQL Server. The EF Core migrations in the backend indicate that the schema is managed via code-first migrations for the business objects.
Relationships and Interactions
• API Layers: The backend’s WebAPI controllers serve as intermediaries that receive requests, invoke services (which in turn use repository methods) and return responses to the client.
• Security: Add a note showing the authentication process, where the Authentication Controller issues JWT tokens after validating credentials, and these tokens secure subsequent API access.
Architectural Patterns
• Layered Pattern: Divide the backend into layers (Controller, Business Object/Services, Data Access, Repositories).
• Repository Pattern: Clearly show that data access is abstracted through repositories.
• Separation of Concerns: With distinct modules in the frontend, represent modularity (different features have their dedicated folders for APIs, views/components, and state management).
• Micro Frontend Features: Not strictly microservices, but the clear separation of modules in the React app reflects a modular design.
• JWT Authentication Flow: Emphasize how security is centrally managed via the authentication controller and middleware.
Detailing Essential Architectural Elements
• Major backend directories (BusinessObject, DataAccess, DataTransfer, WebAPI, Repositories) and outline their roles.
• For the React project, break down the modules (attendance, authentication, etc.) indicating that each module interacts through API calls and shares a common layout and state management setup.
• Optionally, use the provided “Local Development Architecture” image as a reference for drawing network boundaries (i.e., local development environment, backend hosted on a local server, and frontend served via Vite).