Giter VIP home page Giter VIP logo

menekseyuncu / restaurant-management Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 397 KB

This application will be a Back-End application that can manage the basic processes in a restaurant.

Java 100.00%
docker-compose flyway java java-21 jpa junit junit-jupiter lombok mapstruct maven postgresql postman-collection spring-boot docker end-to-end-testing filtering pagination sorting testcontainer testcontainers-postgres

restaurant-management's Introduction

Restaurant Management System

This project is a Back-End application developed to manage the basic processes of a restaurant. The application covers features such as category, product and table management, menu display, table status and order-bill management, as well as table merging and separation.

Tech Stack

Framework

  • Core
    • Spring
      • Spring Boot 3
      • Spring Boot Test (Junit)
      • Spring Boot Dev Tools
      • Spring Web
    • Spring Data
      • Spring Data JPA

3rd Party Dependencies

  • Lombok
  • Test Containers
  • Mapstruct

Database

  • PostgreSql

Database Migration Tool

  • FlyWay

Language

  • Java 21

Build Tool

  • Maven

Version Control

  • Git
  • GitHub

Getting Started

The project has been generated by Spring Initializer. Clone the project files to your computer:

git clone https://github.com/kullanici_adi/proje-adı.git

Requirements

You will need the following requirements to run this project:

  • Java 17+
  • Maven
  • PostgreSQL database
  • Run the application:
./mvnw spring-boot:run

Now your application should be running at http://localhost:8080.

Used Technologies

  • Java 21
  • Spring Boot Latest
  • Maven Latest
  • Spring Data JPA
  • FlyWay
  • PostgreSQL Latest
  • Mapstruct
  • Lombok
  • JUnit
  • Docker
  • Testcontainers

Installation with Docker

Follow the steps below to run the project using Docker.

  • Start PostgreSQL on Docker:
docker run --name postgres -e POSTGRES_PASSWORD=yourpassword -d -p 5432:5432 postgres
  • Run the application inside Docker:

    docker build -t store-management-system .
    docker run -p 8080:8080 --name store-management-system --link postgres:postgres -d store-management-system
    

Database Management

The project uses Flyway for database management. Changes made are automatically applied and can be rolled back. Flyway provides version control of the database schema and keeps the application's database version up to date.

> mvn flyway:migrate -Dflyway.url=... -Dflyway.user=... -Dflyway.password=...

Test

There are unit tests in the project using JUnit and Mockito. You can use the following command to run the tests:

./mvnw test

Postman API Collection

You can use the Postman API collection to test the project. You can download the Postman collection by following the steps below:

  • Postman API Collection

  • Download the collection file by clicking the link.

  • Open the Postman application.

  • Click the 'Import' button in the top left corner.

  • Select 'Import From Link' option and paste the collection link you downloaded.

  • Click the 'Import' button to import the collection.

  • You can now test the API by sending various requests in Postman.

Project Infrastucture

restaurant-management's People

Contributors

menekseyuncu avatar

Stargazers

Aldrin avatar Nuri Can ÖZTÜRK avatar

Watchers

 avatar

Forkers

sprokof

restaurant-management's Issues

Update Category

Category Updated Endpoint

This service will be used for updating the category.

Endpoint:

  • HTTP Method: PUT

  • Endpoint: /api/v1/category/{id}

  • Request:

     {
         "name": "Salad",
         "status": "INACTIVE"
     }
  • Response:
      
      {
          "time": "2024-01-28T05:59:09.376933446",
          "httpStatus": "Ok",
          "isSuccess": "true",
      }
  • Failure:
    {
          "time": "2024-01-28T05:59:09.376933446",
          "header": "401 Unauthorized",
          "isSuccess": false,
    }

Flow:

  • The transmitted id value:

    • If wrong: Return an error indicating that the ID value is incorrect.
    • If it's true, do a soft delete.
  • Validations:

    • name : Cannot be empty and must have a maximum length of 200
  • Status :

    • must be enum (ACTIVE or INACTIVE)
  • Test:

    • Tests should be written for this service.

Database Review

Database Design

classDiagram
class product {
   id | varchar(36), primary key
   name | varchar(300), not null
   ingredient | varchar(2048), not null
   categoriId | bigint, not null, foreign key
   price | numeric(50, 8), not null
   status | enum(ACTIVE, INACTIVE),not null
   extent | integer, not null
   extent_type | enum(ML, GR), not null
   created_at | timestamp(0), not null
   updated_at | timestamp(0)
}
class category{
   id |  bigint, auto increment, primary key
   name | varchar(300), not null
   status | enum(ACTIVE, INACTIVE), not null
   created_at | timestamp(0), not null
   updated_at | timestamp(0)
}
class dining_table {
   id | bigint, auto increment, primary key
   merge_id | varchar(36), not null
   status | enum, not null
   created_at | timestamp(0), not null
   updated_at | timestamp(0)
}
class order {
   id | varchar(36), primary key
   dining_table_merge_id | varchar(36), not null
   status | enum, not null
   price | numeric(50, 8), not null
   created_at | timestamp(0), not null
   updated_at | timestamp(0)
}
class order_item {
   id | varchar(36), primary key
   order_id | varchar(36), not null, foreign key
   product_id | varchar(36), not null, foreign key
   price | numeric(50, 8), not null
   status | enum, not null
   created_at | timestamp(0), not null
   updated_at | timestamp(0)
}
class parameter {
    currency | char(3)
}

product -- order_item: 
order -- order_item: 

Enum

classDiagram
class dining_table_status{
    vacant
    occupied 
    taking_orders
    reserved
}
class order_status {
    open
    in_progress
    completed
    canceled
}
class order_item_status {
    preparing
    ready
    delivered
    canceled
}
class category_status{
   active
   inactive
}
class product_status{
   active
   inactive
}

Get Category By Id

Get Category By Id Endpoint

This service lists the details of the category according to the category's id.

Endpoint:

  • HTTP Method: GET

  • Endpoint: /api/v1/category/{id}

  • Response:

     {
          "time": "2024-01-28T05:59:09.376933446",
          "httpStatus": "OK",
          "isSuccess": true,
          "response": 
              {
                  "id": "1",
                  "name": "Drinks",
                  "status": "ACTIVE",
                  "createdAt": "2024-01-28T05:59:09.376"
              }
     }
  • Failure:
    {
          "time": "2024-01-28T05:59:09.376933446",
          "header": "404 Not Found",
          "isSuccess": false,
    }

Flow:

  • The transmitted id value:
    • If wrong: Return an error indicating that the ID value is incorrect.
  • List the category according to its id.
  • Tests should be written for this service.

Product Listing

Listing Product Endpoint

A service that lists and sorts products by desired value.

Endpoint:

  • HTTP Method: POST

  • Endpoint: /api/v1/products

  • Request:

   {
      "pagination": {
          "pageNumber": 1,
          "pageSize": 1
      },
      "filteredBy": {
          "name": "pizza",
          "priceRange": {
              "min": 50,
              "max": 200
          }
      },
      "sorting": {
          "orderBy": "price",
          "order": "desc"
      }
  }
  • Response:
  {
      "time": "2024-01-28T05:59:09.376933446",
      "httpStatus": "OK",
      "isSuccess": true,
      "response": {
          "content": [
              {
                  "id": "550e8400-e29b-41d4-a716-446655440000",
                  "name": "Pizza",
                  "ingredient": "Domates,Peynir,Pizza Sosu",
                  "price": "150 TRY",
                  "status": "ACTIVE",
                  "extent": 200,
                  "extentType": "GR",
                  "createdAt": "2024-01-28T05:59:09.376"
              }
          ],
          "pageNumber": 1,
          "pageSize": 1,
          "totalPageCount": 1,
          "totalElementCount": 1,
          "filteredBy": {
              "name": [
                  "Pizza"
              ]
          }
      }
  }
  • Failure:
    {
          "time": "2024-01-28T05:59:09.376933446",
          "header": "500 İnternal Server ",
          "isSuccess": false,
    }

Flow:

  • Retrieving All Products
  • Adding pagination structure, which cannot be null
  • Filtering products; filters are optional and can be null or non-existent.
  • Filtering area; Products should be listed based on information such as name and price range.
  • Sorting field; The list should be sorted from largest to smallest based on the price field.
  • Tests should be written for this service.

Get Product By Id

Get Product By Id Endpoint

This service lists the details of the product according to the product's id.

Endpoint:

  • HTTP Method: GET

  • Endpoint: /api/v1/product/{id}

  • Response:

     {
          "time": "2024-01-28T05:59:09.376933446",
          "httpStatus": "OK",
          "isSuccess": true,
          "response": 
              {
                  "id": "550e8400-e29b-41d4-a716-446655440000",
                  "name": "Pizza",
                  "ingredient": "Domates,Peynir,Pizza Sosu",
                  "price": "150 TRY",
                  "productStatus": "ACTIVE",
                  "extent": 200,
                  "extentType": "GR",
                  "createdAt": "2024-01-28T05:59:09.376"
              }
     }
  • Failure:
    {
          "time": "2024-01-28T05:59:09.376933446",
          "header": "404 Not Found",
          "isSuccess": false,
    }

Flow:

  • The transmitted id value:
    • If wrong: Return an error indicating that the ID value is incorrect.
  • List the product according to its id.
  • Tests should be written for this service.

Delete Dining Table

Delete Dining Table Endpoint

This service deletes the selected dining table

Endpoint:

  • HTTP Methodu: DELETE

  • Endpoint: /api/v1/dining-table/{id}

  • Response:

      {
           "time": "2023-10-16T05:59:09.376933446",
           "httpStatus": "OK",
           "isSuccess": true  
      }
  • Failure:
      {
           "time": "2023-10-16T05:59:09.376933446",
           "httpStatus": "401 Unauthorized",
           "isSuccess": false  
      }

Flow:

  • The transmitted id value:
    - If wrong: Return an error indicating that the ID value is incorrect.
    - If it's true, do a soft delete.

Category Listing

Listing Category Endpoint

A service that lists and sorts category by desired value.

Endpoint:

  • HTTP Method: POST

  • Endpoint: /api/v1/categories

  • Request:

  {
      "pagination": {
          "pageNumber": 1,
          "pageSize": 5
      },
      "filteredBy": {
          "name": "Drinks" 
      },
      "sorting": {
          "orderBy": "name",
          "order": "desc"
      }
  }
  • Response:
  {
      "time": "2024-01-28T05:59:09.376933446",
      "httpStatus": "OK",
      "isSuccess": true,
      "response": {
          "content": [
              {
                  "id": "1",
                  "name": "Drinks",
                  "status": "ACTIVE",
                  "createdAt": "2024-01-28T05:59:09.376"
              },
              {
                  "id": "2",
                  "name": "Salad",
                  "status": "ACTIVE",
                  "createdAt": "2024-01-28T05:59:09.376"
              }
          ],
          "pageNumber": 1,
          "pageSize": 1,
          "totalPageCount": 1,
          "totalElementCount": 1
      }
  }
  • Failure:
    {
          "time": "2024-01-28T05:59:09.376933446",
          "header": "500 İnternal Server ",
          "isSuccess": false,
    }

Flow:

  • Retrieving All Categories
  • Adding pagination structure, which cannot be null
  • Filtering category; filters are optional and can be null or non-existent.
  • Filtering area; Category should be listed based on information such as name.
  • Sorting field; The list should be sorted from largest to smallest based on the name field.
  • Tests should be written for this service.

Create Category

Category Creation Endpoint

This service allows adding category to the system.

Endpoint:

  • HTTP Method: POST

  • Endpoint: /api/v1/category

  • Request:

      {
          "name": "Drinks",
          "status": "ACTIVE"
      }
  • Response:
      {
          "time": "2024-01-28T05:59:09.376933446",
          "httpStatus": "OK",
          "isSuccess": true,
      }

Flow:

Validations:
   - name: Cannot be empty and must have a maximum length of 300.
   - status: Cannot be empty and must be either "ACTIVE" or "INACTIVE".
 Test:
   - Tests should be written for this service.

Update Dining Table

Dining Table Updated Endpoint

This service is used to update the dining table.

Endpoint:

  • HTTP Method: PUT

  • Endpoint: /api/v1/dining-table/{id}

  • Request:

      {
          "status": "VACANT",
          "size": 5
      }
  • Response:
      
      {
          "time": "2024-01-28T05:59:09.376933446",
          "httpStatus": "OK",
          "isSuccess": true
      }
  • Failure:
      
      {
          "time": "2024-01-28T05:59:09.376933446",
          "httpStatus": "401 Unauthorized",
          "isSuccess": false
      }

Flow:

  • The transmitted id value::

    • If wrong: Return an error indicating that the ID value is incorrect.
    • If it's true: Return the response
  • The validations to be used in the update stage are:

    • mergeId: can not be null
  • A deleted table should be able to be updated again.

  • Add UUID validation in the controller section.

Order Management - Removing Products from an Order

Removing Products from an Order

This service allows removing multiple products from an existing order.

Endpoint:

  • HTTP Method: DELETE

  • Endpoint: /api/v1/order/{id}/remove

  • Request:

{
    "products": [
        {
            "productId": "9a243fa6-e286-4bcd-a219-1fffde61ed66",
            "quantity": 1
        },
        {
            "productId": "46d3085d-6363-482b-b34c-7fc55ee8d14e",
            "quantity": 1
        }
    ]
}
  • Response:
{
    "time": "2024-06-10T12:00:00",
    "httpStatus": "OK",
    "isSuccess": true,
    "response": {
        "orderId": "fb901b82-3925-45da-90ee-750bd0bedc0d",
        "status": "UPDATED",
        "products": [
            {
                "productId": "9a243fa6-e286-4bcd-a219-1fffde61ed66",
                "quantity": 1,
                "productName": "Grilled Chicken",
                "price": 10.00
            },
            {
                "productId": "fb901b82-3925-45da-90ee-750bd0bedc0d",
                "quantity": 2,
                "productName": "Soup",
                "price": 5.00
            }
        ],
        "totalAmount": 15.00,
        "updatedAt": "2024-06-10T12:00:00"
    }
}

Flow:

  • Removing Products from an Order: The service accepts a list of products to be removed from an existing order by providing the order ID in the path.
  • Product Details: Each product to be removed includes the product ID and quantity.
  • Order Status Update: The order status is updated to "UPDATED" after removing the products.
  • Total Amount Calculation: The total amount for the order is recalculated based on the remaining product prices and quantities.

Table Management - Marking a Table as Occupied

Marking a Table as Occupied Endpoint

This service is designed to mark a table as occupied before any orders are placed.

Endpoint:

  • HTTP Method: POST

  • Endpoint: /api/v1/table/mark/occupied

  • Request:

{
    "tableId": "12",
    "status": "OCCUPIED"
}
  • Response:
{
    "time": "2024-06-10T12:00:00",
    "httpStatus": "OK",
    "isSuccess": true
}

Flow:

  • Marking a Table as Occupied: The service updates the status of the specified table to "OCCUPIED".
  • Status Update: The table's status is changed to indicate it is occupied before any orders are placed.

Testcontainer Integration

Add the Testcontainers structure to create the Test Infrastructure

PostgreSQLContainer<?> POSTGRESQL_CONTAINER = new PostgreSQLContainer<>("postgres:latest")
            .withUsername("restaurant_user")
            .withPassword("restaurant_password")
            .withDatabaseName("restaurant_management");

    @DynamicPropertySource
    static void overrideProps(DynamicPropertyRegistry dynamicPropertyRegistry) {
        POSTGRESQL_CONTAINER.start();
        dynamicPropertyRegistry.add("spring.datasource.username", POSTGRESQL_CONTAINER::getUsername);
        dynamicPropertyRegistry.add("spring.datasource.password", POSTGRESQL_CONTAINER::getPassword);
        dynamicPropertyRegistry.add("spring.datasource.url", POSTGRESQL_CONTAINER::getJdbcUrl);
    }

    @AfterAll
    static void stopContainer() {
        POSTGRESQL_CONTAINER.stop();
    }

Create Dining Table

Dining Table Creation Endpoint

"This service should be able to add a dining table."

Endpoint:

  • HTTP Method: POST

  • Endpoint: /api/v1/dining-table

  • Request:

    {
          "status": "occupied",
          "size": 3,
          "count": 1
    }
  • Response:
      {
          "time": "2024-01-28T05:59:09.376933446",
          "httpStatus": "OK",
          "isSuccess": true
      }

Flow:

  • The validations to be used in the create stage are:
    - status: can not be null
    - size: can not be null
    - count: pozitif bir tam sayı olmalıdır
    - mergeId: mergeId will be automatically created at the time of creation

  • The status determines the availability of the dining table. The status part can be:
    - vacant
    - occupied
    - reserved

Delete Category

Delete Category Endpoint

This service deletes the selected category

Endpoint:

  • HTTP Methodu: DELETE

  • Endpoint: /api/v1/category/{id}

  • Response:

      {
           "time": "2023-10-16T05:59:09.376933446",
           "httpStatus": "OK",
           "isSuccess": true
      }
  • Failure:
    {
          "time": "2024-01-28T05:59:09.376933446",
          "header": "404 Not Found",
          "isSuccess": false,
    }

Flow:

  • The transmitted id value:
    • If wrong: Return an error indicating that the ID value is incorrect.
    • If it's true, do a soft delete.
  • Test:
    • Tests should be written for this service.

Table Management - Marking a Table as Vacant

Marking a Table as Vacant Endpoint

This service is designed to mark a table as vacant.

Endpoint:

  • HTTP Method: POST

  • Endpoint: /api/v1/tables/mark/vacant

  • Request:

{
    "tableId": "12",
    "status": "VACANT"
}
  • Response:
{
    "time": "2024-06-10T12:00:00",
    "httpStatus": "OK",
    "isSuccess": true
}

Flow:

  • Marking a Table as Vacant: The service updates the status of the specified table to "VACANT".
  • Status Update: The table's status is changed to indicate it is vacant

Update Product

Product Updated Endpoint

This service will be used for updating the products.

Endpoint:

  • HTTP Method: PUT

  • Endpoint: /api/v1/product/{id}

  • Request:

     {
         "name": "Pizza",
         "ingredient": "Domates,Peynir,Zeytin,Pizza Sosu",
         "productStatu": "INACTIVE"
         "price": 150 TRY,
         "extent": 200,
         "extentType":"GR"
     }
  • Response:
      
      {
          "time": "2024-01-28T05:59:09.376933446",
          "httpStatus": "Ok",
          "isSuccess": "true",
      }
  • Failure:
    {
          "time": "2024-01-28T05:59:09.376933446",
          "header": "401 Unauthorized",
          "isSuccess": false,
    }

Flow:

  • The transmitted id value:

    • If wrong: Return an error indicating that the ID value is incorrect.
    • If it's true, do a soft delete.
  • The validations to be used in the create stage are:

    • name : Cannot be empty and must have a maximum length of 300
    • ingredient: Cannot be empty and must have a maximum length of 2000
    • price: Cannot be empty and @DecimalMin(value = "0.0"), @DecimalMax(value = "99999999.99999999")
    • extent: Cannot be empty and min value is 1
    • extent_type: Cannot be empty
  • extentType must be enum (ML,GR).

  • productStatus must be enum (ACTIVE or INACTIVE)

Order Management - Placing an Order

Placing an Order

This service is designed to place an order with multiple items.

Endpoint:

  • HTTP Method: POST

  • Endpoint: /api/v1/orders

  • Request:

{
    "tableId": "123",
    "products": [
        {
            "productId": "101",
            "quantity": 2
        },
        {
            "productId": "102",
            "quantity": 1
        }
    ]
}
  • Response:
{
    "time": "2024-06-10T12:00:00",
    "httpStatus": "OK",
    "isSuccess": true,
    "response": {
        "orderId": "596fde5a-b36b-444a-8e54-66ba38d00e1f",
        "tableId": "3",
        "status": "PLACED",
        "products": [
            {
                "productId": "ad35cc2c-974a-48fa-a3cf-089905ea52a0",
                "quantity": 2,
                "productName": "Grilled Chicken",
                "price": 20.00
            },
            {
                "productId": "9a243fa6-e286-4bcd-a219-1fffde61ed66",
                "quantity": 1,
                "productName": "Pasta",
                "price": 12.00
            }
        ],
        "totalAmount": 52.00,
        "createdAt": "2024-06-10T12:00:00",
        "updatedAt": null
    }
}

Flow:

  • Placing an Order: The service accepts an order for a specific table with multiple products.
  • Product Details: Each product in the order includes the product ID and quantity.
  • Order Status: The response includes the order status as "PLACED".
  • Total Amount Calculation: The total amount for the order is calculated based on the product prices and quantities.

Order Management - Adding Products to an Order

Adding Products to an Order

This service allows adding multiple products to an existing order.

Endpoint:

  • HTTP Method: POST

  • Endpoint: /api/v1/order/{id}

  • Request:

{
    "products": [
        {
            "productId": "9a243fa6-e286-4bcd-a219-1fffde61ed66",
            "quantity": 2
        },
        {
            "productId": "46d3085d-6363-482b-b34c-7fc55ee8d14e",
            "quantity": 1
        }
    ]
}
  • Response:
{
    "time": "2024-06-10T12:00:00",
    "httpStatus": "OK",
    "isSuccess": true,
    "response": {
        "orderId": "fb901b82-3925-45da-90ee-750bd0bedc0d",
        "status": "UPDATED",
        "products": [
            {
                "productId": "9a243fa6-e286-4bcd-a219-1fffde61ed66",
                "quantity": 2,
                "productName": "Grilled Chicken",
                "price": 20.00
            },
            {
                "productId": "46d3085d-6363-482b-b34c-7fc55ee8d14e",
                "quantity": 1,
                "productName": "Salad",
                "price": 8.00
            },
            {
                "productId": "fb901b82-3925-45da-90ee-750bd0bedc0d",
                "quantity": 2,
                "productName": "Soup",
                "price": 5.00
            }
        ],
        "totalAmount": 33.00,
        "updatedAt": "2024-06-10T12:00:00"
    }
}

Flow:

  • Adding Products to an Order: The service accepts a list of products to be added to an existing order by providing the order ID in the path.
  • Product Details: Each product to be added includes the product ID and quantity.
  • Order Status Update: The order status is updated to "UPDATED" after adding the products.
  • Total Amount Calculation: The total amount for the order is recalculated based on the new product prices and quantities.

Get Dining Table By Id

List Dining Table By Id Endpoint

This service lists the details of the dining table based on its id.

Endpoint:

  • HTTP Method: GET

  • Endpoint: /api/v1/dining-table/{id}

  • Response:

      
      {
          "time": "2024-01-28T05:59:09.376933446",
          "httpStatus": "OK",
          "isSuccess": true,
          "response": 
              {
                  "id": "1",
                  "status": "vacant",
                  "size": 3,
                  "merge_id": "550e8400-e29b-41d4-a716-446655440000",
                  "createdAt": "2024-01-27T05:59:09.376"
              }
      }

Flow:

 * List the dining table according to its id.
 * If wrong: Return an error indicating that the ID value is incorrect.
 * If it's true: Return the response.

Delete Products

Delete Product Endpoint

This service deletes the selected product

Endpoint:

  • HTTP Methodu: DELETE

  • Endpoint: /api/v1/product/{id}

  • Response:

      {
           "time": "2023-10-16T05:59:09.376933446",
           "httpStatus": "OK",
           "isSuccess": true
      }
  • Failure:
    {
          "time": "2024-01-28T05:59:09.376933446",
          "header": "404 Not Found",
          "isSuccess": false,
    }

Flow:

  • The transmitted id value:
    • If wrong: Return an error indicating that the ID value is incorrect.
    • If it's true, do a soft delete.
  • Test:
    • Tests should be written for this service.

Order Management - Canceling an Order

Marking a Table as Vacant Endpoint

This service is designed to mark a table as vacant.

Endpoint:

  • HTTP Method: DELETE

  • Endpoint: /api/v1/order/{id}

  • Response:

{
    "time": "2024-06-10T12:00:00",
    "httpStatus": "OK",
    "isSuccess": true
}

Flow:

  • Canceling an Order: The service allows the cancellation of an existing order by providing the order ID.
  • Order Status Update: The order status is updated to "CANCELED"

Create Product

Product Creation Endpoint

This service allows adding products to the system.

Endpoint:

  • HTTP Method: POST

  • Endpoint: /api/v1/product

  • Request:

      {
          "name": "Mevsim Salatası",
          "ingredient": "Marul,Domates,Salatalık",
          "price": "15.6 TRY",
          "status": "ACTIVE",
          "extent": 150,
          "extentType": "GR"
      }
  • Response:
      {
          "time": "2024-01-28T05:59:09.376933446",
          "httpStatus": "OK",
          "isSuccess": true,
      }

Flow:

Validations:
   - name: Cannot be empty and must have a maximum length of 300.
   - ingredient: Cannot be empty and must have a maximum length of 2000.
   - price: Cannot be empty and should be in the range between 0.0 and 99999999.99999999.
   - extent: Cannot be empty and must be greater than or equal to 1.
   - extentType: Cannot be empty and must be either "ML" or "GR".
   - status: Cannot be empty and must be either "ACTIVE" or "INACTIVE".

Listing Dining Table

Listing Dining Table Endpoint

A service that lists and sorts dining table by desired value.

Endpoint:

  • HTTP Method: POST

  • Endpoint: /api/v1/dining-tables

  • Request:

   {
      "pagination": {
          "pageNumber": 1,
          "pageSize": 2
      },
      "filteredBy": {
          "status": "VACANT" 
          "size": 3,
      },
      "sorting": {
          "orderBy": "id",
          "order": "desc"
      }
  }
  • Response:
       {
      "time": "2024-01-28T05:59:09.376933446",
      "httpStatus": "OK",
      "isSuccess": true,
      "response": {
          "content": [
              {
                  "id": "3",
                  "status": "VACANT",
                  "size": 3,
                  "merge_id": "550e8400-e29b-41d4-a716-446655440000",
                  "createdAt": "2024-01-27T05:59:09.376",
                  "updatedAt": "2024-01-30T05:59:09.376"
              },
              {
                  "id": "1",
                  "status": "VACANT",
                  "size": 3,
                  "merge_id": "690e8400-e29b-41d4-a716-446655440000",
                  "createdAt": "2024-01-27T05:59:09.376",
                  "updatedAt": "2024-01-30T05:59:09.376"
              }
          ],
          "pageNumber": 1,
          "pageSize": 2,
          "totalPageCount": 1,
          "totalElementCount": 2,
          "filteredBy": {
              "status": [
                  "VACANT"
              ]
          }
      }
  }

Flow:

  • Viewing All Dining Table
  • Filtering Dining Table
  • Adding Pagination Structure
  • Filtering area; It should be able to list according to information such as status.
  • The sorting field should be able to be sorted from largest to smallest based on the id field.
  • If the sorting section is entered and nothing is written, or if it is not entered in the request, return null.

Menu Display Service

Menu Display Service Endpoint

This service is designed to list and group active products within active categories.

Endpoint:

  • HTTP Method: POST

  • Endpoint: /api/v1/menu

  • Request:

{
    "pagination": {
        "pageNumber": 1,
        "pageSize": 10
    },
    "filteredBy": {
        "categoryStatus": "ACTIVE",
        "productStatus": "ACTIVE"
    },
    "sorting": {
        "orderBy": "categoryId",
        "order": "asc"
    }
}
  • Response:
{
    "time": "2024-01-28T05:59:09.376933446",
    "httpStatus": "OK",
    "isSuccess": true,
    "response": {
        "content": [
            {
                "categoryId": "1",
                "categoryName": "Main Courses",
                "categoryStatus": "ACTIVE",
                "products": [
                    {
                        "productId": "690e8400-e29b-41d4-a716-446655440000",
                        "productName": "Grilled Chicken",
                        "productStatus": "ACTIVE",
                        "createdAt": "2024-06-01T12:00:00",
                        "updatedAt": "2024-06-05T12:00:00"
                    },
                    {
                        "productId": "102",
                        "productName": "Pasta",
                        "productStatus": "ACTIVE",
                        "createdAt": "2024-06-01T12:00:00",
                        "updatedAt": "2024-06-05T12:00:00"
                    }
                ]
            },
            {
                "categoryId": "2",
                "categoryName": "Desserts",
                "categoryStatus": "ACTIVE",
                "products": [
                    {
                        "productId": "658e8400-e29b-41d4-a716-446655440000",
                        "productName": "Cheesecake",
                        "productStatus": "ACTIVE",
                        "createdAt": "2024-06-01T12:00:00",
                        "updatedAt": null
                    },
                    {
                        "productId": "899e4260-e29b-41d4-a716-446655440000",
                        "productName": "Profiterole",
                        "productStatus": "ACTIVE",
                        "createdAt": "2024-06-01T12:00:00",
                        "updatedAt": null
                    }
                ]
            }
        ],
        "pageNumber": 1,
        "pageSize": 10,
        "totalPageCount": 1,
        "totalElementCount": 2,
        "filteredBy": {
            "categoryStatus": [
                "ACTIVE"
            ],
            "productStatus": [
                "ACTIVE"
            ]
        }
    }
}

Flow:

  • Viewing the Menu: The service displays the menu by listing all active categories and the active products within those categories.
  • Filtering Categories and Products: The service filters to only show active categories and active products within those categories.
  • Adding Pagination Structure: Results are paginated according to the specified page number and page size.
  • Filtering Area: Categories and products can be filtered based on their status.
  • Sorting Field: Categories can be sorted in ascending or descending order based on the categoryId field.
  • Default Sorting: If the sorting section is not entered or left blank, return null by default.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.