- Framework - Express;
- DB - MongoDB;
- Tests - Jest and SuperTest to make HTTP requests to endpoints;
- Moment for get months between dates to check is product selling month or longer.
To set data in DB install npm packages and run npm run test
. It will set data in DB and also run tests for "Typical use case" that was described in test task, some various tests and tests for each endpoints.
So to start server run npm run dev
. It should start server for you on port 3000. Port you can change in /config/dev.env
. And also you can change url to Mongo.
Also I left in repository Postman Collection with endpoints. First folder Use case
is contain endpoints which are used for "Typical use case" that was described in test task. Request's url hardcoded with localhost:/3000
. Change if you need.
- Only Cashier can create
Order
andBill
; - Cashier can create
Order
and change status fromВыполнен
toОплачен
. Also can see order but with statusesСоздан
andОплачен
; - Consulter can see
Order
only with statusСоздан
and update toВыполнен
; - Booker can see
Order
without any limits and set filters to search orders; - Date filters only in format:
YYYY-MM-DD
. - Products with month selling or longer get discount - 20%.
- Also tried to make discount system. Tested and watch looks like working but I fell like something can go wrong. :)