How dotmarn/trackit-assessment works
Main Components
• API Gateway / Controller Layer:
• API endpoints defined in routes/api.php.
• Controllers (e.g., app/Http/Controllers/Api/EmployeeController.php) that handle incoming HTTP requests for creating and updating employees.
• Request & Validation:
• Request objects (e.g., app/Http/Requests/EmployeeRequest.php) that validate incoming data from different providers.
• Data Transformation Layer:
• Role of DTOs such as app/DTO/EmployeeDTO.php, which standardizes differing input schemas from provider “one” and “two”.
• Use of enums (e.g., app/Enums/ProviderEnum.php) for handling provider-specific logic.
• Business Logic & Service Layer:
• Service (e.g., app/Services/TrackTik.php) which abstracts the integration with the external TrackTik REST API.
• Data Persistence & ORM:
• Models like app/Models/User.php and app/Models/ClientCredential.php which interface with the database.
• That migrations (within database/migrations) and seeders (in database/seeders) set up and manage the database schema.
• External Service Integration:
• Explicitly show the connection to the external TrackTik API using the configurations found in the .env file and config/services.php.
Relationships and Interactions
• How data flows from controllers to the DTO, which normalizes provider-specific input.
• DTO transformation step to the Service layer that interacts with the TrackTik API.
• That models interact with the database, with migrations applied during deployment.
Architectural Patterns and Design Principles
• MVC Pattern: Clearly separate the Controller (HTTP layer), Model (ORM & Persistence), and View (if applicable; in this case, primarily API responses).
• Service Abstraction: Use the service class to encapsulate external API interactions.
• DTO Pattern: Transform and normalize data inputs from different providers.
• Request Validation: Ensure that incoming API requests are validated before processing.
Additional Details
• Boundaries where unit and feature tests (found in tests/Unit and tests/Feature) validate the system’s behavior.