TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/devdavco/backend_1/llms.txt
Use this file to discover all available pages before exploring further.
POST /reserva/create endpoint persists a new booking in the reservas table and returns the fully-saved Reserva object with its assigned id. The request body must include the IDs of both the user and the space being booked, three timestamps defining the session window and the post-cleaning end time, and an initial estado. Both foreign-key IDs are validated against the database before the record is saved — if either does not exist, the request is rejected with a 500 error.
Request body
ID of the coworking space to book. Must be a positive integer that references an existing
Espacio record. Values of 0 or below are rejected.ID of the user making the booking. Must be a positive integer that references an existing
Usuario record. Values of 0 or below are rejected.Start time of the reservation. Must be formatted as
yyyy-MM-dd HH:mm (e.g. "2025-06-10 09:00"). Seconds and timezone offsets are not accepted.The time at which the user’s session ends. Must be formatted as
yyyy-MM-dd HH:mm. This should be later than horaInicio and earlier than horaFinTotal.The absolute end of the reserved slot, including the space’s post-session cleaning buffer. Must be formatted as
yyyy-MM-dd HH:mm. Calculate this as horaFinUsuario plus the value of espacio.minutos_limpieza for the chosen space.Initial lifecycle status. Must be one of
confirmada, pendiente, or cancelada.Optional initial version value for optimistic locking. Defaults to
null when omitted. JPA’s @Version mechanism will manage this field automatically after creation; most callers should leave it unset.Validation rules
The service layer (ReservaServiceImpl) enforces the following before persisting:
- The request object itself must not be
null. usuarioIdmust be non-null and greater than0. A matchingUsuariorecord must exist in the database.espacioIdmust be non-null and greater than0. A matchingEspaciorecord must exist in the database.
500 error with a descriptive message.
Request
Response
Returns201 Created with the full persisted Reserva object.
Response fields
Auto-generated primary key assigned by the database on insert.
ID of the user who owns the booking, as supplied in the request.
ID of the coworking space, as supplied in the request.
Persisted start time in
yyyy-MM-dd HH:mm format.Persisted user session end time in
yyyy-MM-dd HH:mm format.Persisted absolute end time (including cleaning buffer) in
yyyy-MM-dd HH:mm format.The initial status value that was saved. One of
confirmada, pendiente, or cancelada.Initial optimistic-locking version. Will be
0 when version was omitted from the request body, or the supplied value if one was provided.