Reservation - Yorbre25/P3SOA_MY_microRESTaurant GitHub Wiki

updateReservation

Updates an existing reservation by sending updated reservation details to the backend API.

Input

{
  "User_id": "string",
  "Id": "string",
  "Date": "string",
  "Time": "string",
  "Number_of_people": "number"
}

Response

  • Success: Returns a confirmation message or object indicating successful update.
  • Error: Returns an error object detailing what went wrong during the request.

getReservationsFromUser

Description Fetches reservations specific to a user using their unique identifier.

Input

{
  "User_id": userId
}

Response

  • Success: Returns a list of reservation objects specific to the user.
  • Error: Returns an error object detailing what went wrong during the request.

Recommendation System

Operation

This function, given a user input consisting of some menu choices, provides recommendations for the requested type of item.

There are three types of items on the menu

  • main_dish
  • drink
  • dessert

The user can choose up to two of the above elements from our menu and request a recommendation for the remaining type of item. They can also choose only one item and request recommendations for the other two. Finally, as an extreme case, they may have no preferences and request recommendations for all three items. Or they can enter all three dishes, in which case nothing will be recommended to them, and they will simply be redirected to the dishes they already provided.

Input

As input the user must send a json with the following structure

{
    "meal":{
        "main_dish":"Pizza",
        "drink":"",
        "dessert": "ice cream"
    },
    "recommendation_of":["drink"]
}

It is worth mentioning that when sending inputs, this service performs input validations. In this case, it is verified that "meal" is an object with the specified fields, and furthermore, these fields must each have a string value. On the other hand, it is verified that "recommendation_of" exists and its value must be a list of strings, where the only possible valid strings are: "main_dish", "coke", and "dessert".

Output

   {
    "main_dish":"Pizza",
    "drink":"coke",
    "dessert":"ice cream"
   }

Function in the system

In the following image you can see the request's flow in which the function participates. In this case this functions its called when a suggestion its requested by the frontend to the backend. As you can see in the figure, the only service the recommendation services interacts in a direct way its the backend. As discussed previously the recommendation service, given the restaurant menu, and the selected inputs by sent by the front end, shows the menu suggested for consumption

loadReservations

Loads all reservations for admins.

deleteReservation

Deletes a specific reservation using its ID.

Input

{
  "ID": reservationId
}

Response

  • Success: Returns a confirmation message or object indicating the reservation has been successfully deleted.
  • Error: Returns an error object detailing what went wrong during the request.