Assume theres 4 endpoints: @PostMapping("/reserve/{staffId}/{serviceId}/{dateTime}") -…
- User
Assume theres 4 endpoints: @PostMapping("/reserve/{staffId}/{serviceId}/{dateTime}") - returns json with id if no errors @DeleteMapping("/cancel/{reservationId}") - empty response if no errors @PostMapping("/restore/{reservationId}") - empty response if no errors @GetMapping("/by-service-and-staff/{serviceId}/{staffId}/{from}/{to}") - and this one to retrieve available slots (do it once before all workers start) with only that parameters: retrieval/by-service-and-staff/1/1/2025-03-01/2025-04-10, heres example response: { "2025-03-01": [], "2025-03-02": [ { "start": "08:00:00", "end": "09:00:00", "cost": 20.0, "maxReservations": 1 }, { "start": "09:30:00", "end": "10:30:00", "cost": 20.0, "maxReservations": 1 }, { "start": "11:00:00", "end": "12:00:00", "cost": 20.0, "maxReservations": 1 }, { "start": "12:00:00", "end": "13:00:00", "cost": 20.0, "maxReservations": 1 }, { "start": "14:00:00", "end": "15:00:00", "cost": 20.0, "maxReservations": 1 }, { "start": "16:00:00", "end": "17:00:00", "cost": 20.0, "maxReservations": 1 } ] }
So, you need to fetch available slots like this, and start some amount of worker threads that will call the first 3 endpoints randomly (while keeping track of what reservations theyve made to know which ones they can cancell/restore)
Assistant