Class: Reservation

Reservation(reservationId, customerName, customerContact, reservationDateTime, numberOfGuests, tableIdopt, statusopt, specialRequestsopt, createdAtopt, updatedAtopt)

Represents a reservation made by a customer.

Constructor

new Reservation(reservationId, customerName, customerContact, reservationDateTime, numberOfGuests, tableIdopt, statusopt, specialRequestsopt, createdAtopt, updatedAtopt)

Creates a new Reservation.
Parameters:
Name Type Attributes Default Description
reservationId string Unique identifier for the reservation.
customerName string Name of the customer.
customerContact string Customer's contact details.
reservationDateTime string | Date Date and time of the reservation.
numberOfGuests number Total number of guests.
tableId string | null <optional>
null Assigned table ID (optional at creation).
status string <optional>
"Pending" Status of the reservation (Pending, Confirmed, Completed, Cancelled).
specialRequests string <optional>
"" Any special customer requests.
createdAt Date <optional>
new Date() Timestamp when the reservation was created.
updatedAt Date <optional>
new Date() Timestamp when the reservation was last updated.
Source:

Methods

assignTable(tableId)

Assigns a table to the reservation and updates the status to "Confirmed".
Parameters:
Name Type Description
tableId string The ID of the table to assign.
Source:

changeStatus(newStatus)

Changes the status of the reservation.
Parameters:
Name Type Description
newStatus string The new status (Pending, Confirmed, Completed, Cancelled).
Source:

isUpcoming() → {boolean}

Checks if the reservation is for a future date and time.
Source:
Returns:
True if the reservation is upcoming, otherwise false.
Type
boolean

updateDetails(customerName, customerContact, reservationDateTime, numberOfGuests, tableId, status, specialRequests)

Updates the reservation details.
Parameters:
Name Type Description
customerName string Updated name of the customer.
customerContact string Updated contact details.
reservationDateTime string | Date Updated date and time of the reservation.
numberOfGuests number Updated total number of guests.
tableId string Updated table ID.
status string Updated status of the reservation.
specialRequests string Updated special requests.
Source: