How its-quasi/parking-apirest works
Based on our review of the file tree and README, this project is a backend API service designed for managing parking-related operations (users, parking logs, etc.) for a technical test (Solución planteada a prueba técnica Nelumbo). The project employs a layered architecture using Node.js (with TypeScript) and integrates with a PostgreSQL database (the README even shows how to launch a Docker container for it).
Main Components
• API Layer – Represent the Express application, which can be inferred from files like src/app.ts and src/index.ts. This layer handles incoming HTTP requests.
• Routing – Include the “routes” folder components (admin.routes.ts, auth.routes.ts, indicators.routes.ts, partner.routes.ts). These define the REST endpoints.
• Service Layer – Display the services (auth.service, admin.service, indicators.service, partner.service, jwt.service) which encapsulate the business logic.
• Data Layer – Include data models (parking, parkingLog, user) and mention the connection file (data-source.ts). This is where interaction with the PostgreSQL database happens.
• DTOs – Illustrate how Data Transfer Objects (createLogDto, parkingDto, userDto) are used for validating and structuring data between the API and the services.
• Utilities – Capture utility modules (handlerPasswords, handlerTime, plateValidator, role) that provide supporting functions across the application.
• Configuration Components – Note the environment configuration (.env file instructions) and the package-related files for dependency management.
Relationships and Interactions
• Routes → Middlewares: Illustrate that requests pass through various middleware components (token verification, role validations, etc.) before reaching business logic.
• Service Layer → Data Layer: Connect service modules to the data models and database connection, highlighting data persistence and retrieval operations.
• Service Layer → DTO Conversion: Optionally represent conversion/validation using DTOs to ensure well-defined data formats.
• Utilities: Connect the utilities to both the service and middleware layers where required.
Architectural Patterns & Technologies
• Pattern: The project follows a modular or layered architecture, with a clear separation between the API, business logic, and data persistence layers.
• Technology Stack: Node.js with TypeScript for application logic; Express (implicitly via middleware and routing structure) for HTTP request handling; a PostgreSQL database (set up via Docker according to the README); likely some ORM or database abstraction in the data-source.ts file.
• Security: Integration of JWT-based authentication (as seen in jwt.service and verifyToken middleware) and role-based access controls (various role verification middlewares).