How quangphu1310/paradisevilla works
Main Components
• API Layer (ParadiseVilla_API):
• Controllers organized by API version (v1 and v2) for managing villas, villa numbers, and user-related operations.
• Data layer with ApplicationDbContext and migration scripts to manage schema changes.
• Models including domain models and a set of DTOs used for data transfer.
• Repository implementations (and interfaces) that abstract data access.
• Configuration classes like MappingConfig that set up AutoMapper.
• Security components for authentication (JWT, Identity) and role-based access.
• Web Layer (ParadiseVilla_Web):
• MVC Controllers that control user interactions, managing views and calling backend services.
• Views and ViewModels to render the client-side UI.
• Service layer (with services like AuthService, VillaService, etc.) that act as a client to the API.
• Frontend assets including CSS, JavaScript, Bootstrap resources for improved UX.
• Utility Layer (ParadiseVilla_Utility):
• Shared library for common definitions such as static details or constants (see SD.cs).
• Database:
• A SQL Server database accessed via Entity Framework Core and handled through migrations.
Relationships and Interactions
• The MVC Web application acts as the presentation layer where users interact via web pages.
• Requests from users are processed in the Web layer and then forwarded to the API layer for business logic execution.
• The API layer (ParadiseVilla_API) accepts RESTful requests, applies authentication (JWT/Identity) and handles operations using the repository pattern.
• Domain models (and DTOs) are used within the API to map data between the business layer and the SQL Server database.
• The repository layer abstracts the data access (using EF Core) that interacts with the underlying database.
• AutoMapper is used to convert between Domain Models and DTOs across the layers.
• Multiple API versions are maintained (e.g., v1 and v2) – indicate branching in the controller components.
Architectural Patterns and Design Principles
• Layered Architecture: Separate presentation, API/business, and data access layers help in maintaining separation of concerns.
• Repository Pattern: The abstraction over data access operations keeps the data logic isolated.
• Dependency Injection: Utilized for service registration and management of dependencies among controllers, services, and repositories.
• DTOs and AutoMapper: Ensure safe and efficient data transfer between layers.
• Versioning of APIs: Shows attention to evolutionary design/redesign over time without breaking existing functionality.
• Security Implementation: Integration of Identity, JWT for secure authentication and role-based authorization.