66
77## DTOs
88
9- For information on the Data Transfer Objects (DTOs) used in the requests and responses, [ check out the DTOs here] ( /src/main/kotlin/com/example/dto ) .
9+ For information on the Data Transfer Objects (DTOs) used in the requests and
10+ responses, [ check out the DTOs here] ( /src/main/kotlin/com/example/dto ) .
11+
12+ <div align =" center " >
13+ <img src =" public/diagram.png " />
14+ </div >
1015
1116## User API Endpoints
1217
1318### Register User
19+
1420- ** POST** ` /register `
15- - Description: Registers a new user with the provided details.
16- - Request Body: ` UserRegisterDto ` (Object) - Data Transfer Object containing user registration details.
17- - Responses:
18- - ` 201 Created ` if registration is successful.
19- - ` 400 Bad Request ` with error message if registration fails.
21+ - Description: Registers a new user with the provided details.
22+ - Request Body: ` UserRegisterDto ` (Object) - Data Transfer Object containing user registration details.
23+ - Responses:
24+ - ` 201 Created ` if registration is successful.
25+ - ` 400 Bad Request ` with error message if registration fails.
2026
2127### User Login
28+
2229- ** POST** ` /login `
23- - Description: Authenticates a user and returns a user identifier upon successful login.
24- - Request Body: ` UserLoginDto ` (Object) - Data Transfer Object containing user login credentials.
25- - Responses:
26- - ` 200 OK ` with user identifier if login is successful.
27- - ` 401 Unauthorized ` with error message if login fails.
30+ - Description: Authenticates a user and returns a user identifier upon successful login.
31+ - Request Body: ` UserLoginDto ` (Object) - Data Transfer Object containing user login credentials.
32+ - Responses:
33+ - ` 200 OK ` with user identifier if login is successful.
34+ - ` 401 Unauthorized ` with error message if login fails.
2835
2936### Get User Profile
37+
3038- ** GET** ` /profile/{userId} `
31- - Description: Retrieves the profile details of a specific user.
32- - Path Parameters: ` userId ` (UUID) - The unique identifier of the user.
33- - Responses:
34- - ` 200 OK ` with user profile details if found.
35- - ` 404 Not Found ` with error message if user profile is not found.
39+ - Description: Retrieves the profile details of a specific user.
40+ - Path Parameters: ` userId ` (UUID) - The unique identifier of the user.
41+ - Responses:
42+ - ` 200 OK ` with user profile details if found.
43+ - ` 404 Not Found ` with error message if user profile is not found.
3644
3745### Get User Profile Flow
46+
3847- ** GET** ` /profile/{userId}/flow `
39- - Description: Retrieves a flow of profile details for a specific user. This is typically used for real-time updates.
40- - Path Parameters: ` userId ` (UUID) - The unique identifier of the user.
41- - Responses:
42- - ` 200 OK ` with a flow of user profile details if found.
43- - ` 404 Not Found ` with error message if user profile is not found.
48+ - Description: Retrieves a flow of profile details for a specific user. This is typically used for real-time
49+ updates.
50+ - Path Parameters: ` userId ` (UUID) - The unique identifier of the user.
51+ - Responses:
52+ - ` 200 OK ` with a flow of user profile details if found.
53+ - ` 404 Not Found ` with error message if user profile is not found.
4454
4555### Update User Location
56+
4657- ** POST** ` /profile/{userId}/location `
47- - Description: Updates the location details for a specific user's profile.
48- - Path Parameters: ` userId ` (UUID) - The unique identifier of the user.
49- - Request Body: ` UserUpdateLocationDto ` (Object) - Data Transfer Object containing new location details.
50- - Responses:
51- - ` 200 OK ` if the location is successfully updated.
52- - ` 404 Not Found ` with error message if the user profile is not found or update fails.
58+ - Description: Updates the location details for a specific user's profile.
59+ - Path Parameters: ` userId ` (UUID) - The unique identifier of the user.
60+ - Request Body: ` UserUpdateLocationDto ` (Object) - Data Transfer Object containing new location details.
61+ - Responses:
62+ - ` 200 OK ` if the location is successfully updated.
63+ - ` 404 Not Found ` with error message if the user profile is not found or update fails.
5364
5465## Order API Endpoints
5566
5667### Add Item to Order
68+
5769- ** POST** ` /orders/{userId}/items `
5870 - Adds a food item to the user's order.
5971 - ** Path** : ` userId ` (UUID as string)
6072 - ** Body** : ` FoodDto ` (JSON)
6173 - ** Response** : ` 200 OK ` with order ID, ` 500 Internal Server Error ` with error message.
6274
6375### Update Order Item Quantity
76+
6477- ** POST** ` /orders/items/{itemId} `
6578 - Updates the quantity of an item in the order.
6679 - ** Path** : ` itemId ` (Integer)
6780 - ** Body** : Quantity (Integer)
6881 - ** Response** : ` 200 OK ` with item details, ` 500 Internal Server Error ` with error message.
6982
7083### Get Active Order
84+
7185- ** GET** ` /orders/{userId} `
7286 - Retrieves the user's active order.
7387 - ** Path** : ` userId ` (UUID as string)
7488 - ** Response** : ` 200 OK ` with order details, ` 404 Not Found ` with error message.
7589
7690### Complete Order
91+
7792- ** GET** ` /orders/{userId}/complete `
7893 - Completes the user's current order.
7994 - ** Path** : ` userId ` (UUID as string)
8095 - ** Response** : ` 200 OK ` with completion status, ` 500 Internal Server Error ` with error message.
8196
8297### Delete Current Order
98+
8399- ** DELETE** ` /orders/{userId}/current `
84100 - Deletes the user's current order.
85101 - ** Path** : ` userId ` (UUID as string)
86102 - ** Response** : ` 200 OK ` with deletion status, ` 500 Internal Server Error ` with error message.
87103
88104### Delete Specific Order
105+
89106- ** DELETE** ` /orders/{userId}/{orderId} `
90107 - Deletes a specific order for the user.
91108 - ** Path** : ` userId ` (UUID as string), ` orderId ` (Integer)
@@ -94,18 +111,21 @@ For information on the Data Transfer Objects (DTOs) used in the requests and res
94111## Food API Endpoints
95112
96113### Get Food Details
114+
97115- ** GET** ` /foods/{foodId} `
98116 - Retrieves details for a specific food item.
99117 - ** Path** : ` foodId ` (Integer)
100118 - ** Response** : ` 200 OK ` with food details, ` 404 Not Found ` with error message.
101119
102120### List All Foods or Search
121+
103122- ** GET** ` /foods `
104123 - Lists all foods or returns search results based on query.
105124 - ** Query** : ` search ` (String, optional) - Search term for food items.
106125 - ** Response** : ` 200 OK ` with list of foods or search results, ` 404 Not Found ` with error message.
107126
108127### Get Foods by Category
128+
109129- ** GET** ` /foods/categories `
110130 - Retrieves foods filtered by category.
111131 - ** Query** : ` type ` (String, optional) - Category type, defaults to "all".
0 commit comments