| 1 | == Customer makes reservation == |
| 2 | === Актери === |
| 3 | * Customer |
| 4 | === Scenario steps === |
| 5 | 1. Customer logs in. |
| 6 | 2. Customer enters reservation details: date and time, number of people and stay length. |
| 7 | 3. If an available table is found, proceed with reservation. |
| 8 | 4. Applications shows reservation details to the customer. |
| 9 | === SQL Queries === |
| 10 | |
| 11 | {{{ |
| 12 | SELECT u.email, u.password FROM users u WHERE u.email = ?; -- and password application check |
| 13 | }}} |
| 14 | {{{ |
| 15 | SELECT table_number |
| 16 | FROM tables |
| 17 | WHERE seat_capacity >= chosen_capacity |
| 18 | AND table_number NOT IN ( |
| 19 | SELECT table_number |
| 20 | FROM frontstaff_managed_reservations |
| 21 | WHERE reservation_id IN ( |
| 22 | SELECT id FROM reservations |
| 23 | WHERE datetime BETWEEN entered_date_time AND entered_date_time+entered_stay |
| 24 | ) |
| 25 | ); |
| 26 | }}} |
| 27 | {{{ |
| 28 | INSERT INTO reservations (stay_length, datetime, creation_timestamp, number_of_people, user_id) |
| 29 | VALUES (2, '2025-02-10 19:00:00', NOW(), 4, 5); |
| 30 | }}} |
| 31 | {{{ |
| 32 | SELECT r.id, r.datetime, r.number_of_people, t.table_number, u.email |
| 33 | FROM reservations r |
| 34 | JOIN frontstaff_managed_reservations rmf ON r.id = rmf.reservation_id |
| 35 | JOIN tables t ON rmf.table_number = t.table_number |
| 36 | JOIN users u ON r.user_id = u.id |
| 37 | WHERE r.id = 10; |
| 38 | }}} |