Welcome, and thanks for checking out the repository! I'm sure that you're much more than able to check everything out yourself, but just in case. I’ll keep things concise, and feel free to reach out if you have any questions or need further clarification.
Note
I believe that this codebase requires much further polishing and revision. Due to time constraints (2 hours), not everything I initially planned could be implemented. I appreciate your understanding.
-
Authentication Simulation
A simple authentication system has been implemented. Note that token-based authentication is not included due to the lack of external packages likeSymfony. -
Database Relations
Migrations are used to define relationships between entities. -
DDD Architecture
I have followed a Domain-Driven Design (DDD) approach to ensure separation of concerns, as outlined in the task description. While it introduced an additional mapping layer and seemed somewhat complex for the size of this project, I also lacked external libraries. -
Minimal UI
The/checkoutendpoint provides a minimal UI where a discount code (sent via email) can be applied to update the total order price. The discount code is tracked and marked as used in the database.
-
Start the Database
Run the following command to start the local database:docker-compose up -d
The database will be accessible on port
3307. You can modify the configuration if needed. -
Install Dependencies
Install the necessary PHP dependencies:composer install
-
Run Migrations
Apply the migrations and reset the database:php artisan migrate:fresh
-
Seed the Database
Generate 10 sample products for testing:php artisan db:seed
-
Test with an API Client
Use any API client (e.g., Postman, Insomnia) to test the available endpoints.
To make testing easier, I’ve included a small Postman collection for testing the API endpoints. You can import the collection into Postman and use it to quickly send requests to the API.
The collection includes requests for:
- Authenticating users
- Creating and updating orders
- Viewing orders and products
And here's a small sequence diagram illustrating the required actions to test the functionality:
I hope this helps provide a clearer overview of this 'project'.