Please make sure to change the docker-compose.yaml environment is suitable to your environment (no need .env file)
PORT=8090 DB_HOST=localhost DB_USER=postgres DB_PASSWORD=postgres DB_NAME=postgres DB_PORT=5432 JWT_SECRET_KEY=3kj9dk23oi9d390oq
- Table Name: customers
Column Name | Data Type | Constraints | Description |
---|---|---|---|
id | serial | Primary Key | Unique ID for the customer |
name | varchar(255) | Not Null | Name of the customer |
varchar(255) | Not Null, Unique | Email of the customer | |
password | varchar(255) | Not Null | Password of the customer |
address | text | Address of the customer | |
created_at | timestamptz | Auto-generated | Creation timestamp |
updated_at | timestamptz | Auto-generated | Last update timestamp |
- Table Name: orders
Column Name | Data Type | Constraints | Description |
---|---|---|---|
id | serial | Primary Key | Unique ID for the order |
customer_id | bigint | Not Null | ID of the associated customer |
product_name | varchar(255) | Not Null | Name of the product |
quantity | bigint | Not Null | Quantity of the product |
total_price | double precision | Not Null | Total price of the order |
created_at | timestamptz | Auto-generated | Creation timestamp |
updated_at | timestamptz | Auto-generated | Last update timestamp |
- Table Name: login_data
Column Name | Data Type | Constraints | Description |
---|---|---|---|
id | serial | Primary Key | Unique ID for the login data |
customer_id | bigint | Not Null | ID of the associated customer |
login_time | timestamptz | Auto-generated | Login timestamp |
ip_address | varchar(45) | IP address of the login | |
token | varchar(255) | Not Null | Token for authentication |
- URL:
/customers
- Method:
GET
- Description: Get a list of all customers.
- Parameters: None
- Response:
- Status Code:
200 OK
- Body: Array of customer objects.
- Status Code:
- URL:
/customers
- Method:
POST
- Description: Create a new customer.
- Parameters: None
- Request Body: Customer object with the following properties:
- name (string): Name of the customer.
- email (string): Email of the customer.
- password (string): Password of the customer.
- address (string): Address of the customer.
- Response:
- Status Code:
201 Created
- Body: The created customer object.
- Status Code:
- URL:
/customers/{customerId}
- Method:
GET
- Description: Get details of a specific customer.
- Parameters:
- customerId (integer): ID of the customer to retrieve.
- Response:
- Status Code:
200 OK
- Body: The customer object.
- Status Code:
- URL:
/customers/{customerId}
- Method:
PUT
- Description: Update details of a specific customer.
- Parameters:
- customerId (integer): ID of the customer to update.
- Request Body: Customer object with the updated properties.
- Response:
- Status Code:
200 OK
- Body: The updated customer object.
- Status Code:
- URL:
/customers/{customerId}
- Method:
DELETE
- Description: Delete a specific customer.
- Parameters:
- customerId (integer): ID of the customer to delete.
- Response:
- Status Code:
204 No Content
- Status Code:
- URL:
/orders
- Method:
GET
- Description: Get a list of all orders.
- Parameters: None
- Response:
- Status Code:
200 OK
- Body: Array of order objects.
- Status Code:
- URL:
/orders
- Method:
POST
- Description: Create a new order.
- Parameters: None
- Request Body: Order object with the following properties:
- customer_id (integer): ID of the customer placing the order.
- product_name (string): Name of the product.
- quantity (integer): Quantity of the product.
- total_price (number): Total price of the order.
- Response:
- Status Code:
201 Created
- Body: The created order object.
- Status Code:
- URL:
/orders/{orderId}
- Method:
GET
- Description: Get details of a specific order.
- Parameters:
- orderId (integer): ID of the order to retrieve.
- Response:
- Status Code:
200 OK
- Body: The order object.
- Status Code:
- URL:
/orders/{orderId}
- Method:
PUT
- Description: Update details of a specific order.
- Parameters:
- orderId (integer): ID of the order to update.
- Request Body: Order object with the updated properties.
- Response:
- Status Code:
200 OK
- Body: The updated order object.
- Status Code:
- URL:
/orders/{orderId}
- Method:
DELETE
- Description: Delete a specific order.
- Parameters:
- orderId (integer): ID of the order to delete.
- Response:
- Status Code:
204 No Content
- Status Code:
- URL:
/login
- Method:
POST
- Description: Login and generate JWT token.
- Parameters: None
- Request Body: Credentials object with the following properties:
- username (string): Username of the user.
- password (string): Password of the user.
- Response:
- Status Code:
200 OK
- Body: JWT token.
- Status Code:
- URL:
/login/{customer_id}
- Method:
GET
- Description: Get login data for a specific customer.
- Parameters:
- customer_id (integer): ID of the customer.
- Response:
- Status Code:
200 OK
- Body: Login data object.
- Status Code: