Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cmsrs/ingenious
laravel task
https://github.com/cmsrs/ingenious
Last synced: 11 days ago
JSON representation
laravel task
- Host: GitHub
- URL: https://github.com/cmsrs/ingenious
- Owner: cmsrs
- Created: 2023-11-30T16:43:15.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-06T18:27:31.000Z (about 1 year ago)
- Last Synced: 2023-12-07T16:48:05.977Z (about 1 year ago)
- Language: Dockerfile
- Size: 2.8 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Recruitment Task π§βπ»π©βπ»
### Invoice module with approve and reject system as a part of a bigger enterprise system. Approval module exists and you should use it. It is Backend task, no Frontend is needed.
---
Please create your own repository and make it public or invite us to check it.- Invoice contains:
- Invoice number
- Invoice date
- Due date
- Company
- Name
- Street Address
- City
- Zip code
- Phone
- Billed company
- Name
- Street Address
- City
- Zip code
- Phone
- Email address
- Products
- Name
- Quantity
- Unit Price
- Total
- Total priceImage just for visualization
### TO DO:
Simple Invoice module which is approving or rejecting single invoice using information from existing approval module which tells if the given resource is approvable / rejectable. Only 3 endpoints are required:
```
- Show Invoice data, like in the list above
- Approve Invoice
- Reject Invoice
```
* In this task you must save only invoices so donβt write repositories for every model/ entity.* You should be able to approve or reject each invoice just once (if invoice is approved you cannot reject it and vice versa.
* You can assume that product quantity is integer and only currency is USD.
* Proper seeder is located in Invoice module and itβs named DatabaseSeeder
* In .env.example proper connection to database is established.
* Using proper DDD structure is mandatory (with elements like entity, value object, repository, mapper / proxy, DTO).
Unit tests in plus.* Docker is in docker catalog and you need only do
```
./start.sh
```
to make everything workdocker container is in docker folder. To connect with it just:
```
docker compose exec workspace bash
```### My solution:
1.
```
php artisan migrate
```2.
run test
```
./vendor/bin/phpunit ./tests/Feature/Modules/Invoices/Infrastructure/Database/Models/InvoiceTest.php
```3.
my changes (commit name: My solution):
```
git show 980a08352837198e72b9ca9808cbb5d4890afb23
```4.
example endpoints:
```
http://localhost:8000/api/show/2b9fbae0-8709-48f3-ad95-d5d29d7839af
``````
http://localhost:8000/api/reject/2b9fbae0-8709-48f3-ad95-d5d29d7839af
``````
http://localhost:8000/api/approve/2b9fbae0-8709-48f3-ad95-d5d29d7839af
```TODO:
- it is not written in DDD
- usage of eloquent models in Controllers (todo RS: use service - easy)
- Controllers are heavy: code is not encapsulated in Service/Command/etc (todo RS: use service - easy)
- Invoice module invokes ApprovalFacade directly instead of usage of adapter pattern (RS: fix, see commit: "fix: Invoice module invokes ApprovalFacade directly instead of usage of adapter pattern")