/Assignment

The guys from Payaut gave me an assignment, that's the result...

Primary LanguageJava

REST service (100% Java)

erDiagram
    item {
        bigint id PK
        timestamp created_at
        varchar item_name
        enum item_type
        enum item_unit
        bigint discount_id FK
    }

 discount {
        bigint id PK
        enum discount_unit
        boolean is_constant_slab
    }

    discount_slab {
        bigint id PK
        double discount_amount
        bigint units_to_get_discount
        bigint discount_id FK
    }

    discount ||--|{ discount_slab : discount_id
    discount |o --|| item : discount_id
Loading

Documentation

All the endpoints and possible requests/exceptions are documented in Postman(and many of them in Javadoc). The requisitions are with fulfilled bodies and ready to be tested locally

Run in Postman

How it works?

Capture d’écran 2024-04-29 à 09 17 59

The DB

I have used H2 in memory db (100% Java), so if you want to take a look in the tables access /api/v1/h2 and you will have access to the console (credentials in the application.properties)

Enregistrement.de.l.ecran.2024-04-29.a.08.32.35.mov

Item's cheat sheet

Use these identifiers (default data) to interact with the API

ID CREATED_AT ITEM_NAME ITEM_PRICE ITEM_TYPE ITEM_UNIT DISCOUNT_ID
1 2024-04-24 10:00:00 Vegetables 0.01 VEGETABLES GRAM 1
2 2024-04-24 11:00:00 Dutch Beer 0.5 BEERS PIECE 2
3 2024-04-25 11:00:00 Bread 1.0 BREADS PIECE 3
4 2024-04-24 11:00:00 Belgium Beer 0.75 BEERS PIECE 4
5 2024-04-24 11:00:00 German Beer 1.0 BEERS PIECE 5

Other projects you might like

Laravel ambassador A monolith built with PHP, Docker, MySQL and Redis

Main Chainz API An open source Nodejs api built with MySQL, Redis, and many other technologies