adityanandanx / adityanandanx/raftaar

5. Bike Reservation (5-min lock)

Offen
#6 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
0
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

## Parent PRD

#1

## What to build

Reservation system that locks a bike for 5 minutes when a customer selects it. Customers should be able to reserve a bike, see their active reservation with countdown timer, and cancel before the timer expires. Reservations automatically expire after 5 minutes if the trip is not started.

Implements reservation state machine, overbooking prevention (one reservation per bike), expiry background job, and frontend countdown UI.

## Acceptance criteria

- [ ] `POST /bookings/reserve` reserves bike for 5 minutes (JWT required)
- [ ] Response includes: reservation_id, bike_id, station_id, expires_at timestamp
- [ ] `GET /bookings/active` returns current active reservation (JWT required)
- [ ] `POST /bookings/cancel` cancels reservation before expiry (JWT required)
- [ ] Cannot reserve a bike that is already reserved or in use
- [ ] Reservation expires exactly 5 minutes after creation
- [ ] Background job removes expired reservations every minute
- [ ] Cannot reserve bike with status != 'available'
- [ ] Customer can only have ONE active reservation at a time
- [ ] Database schema: `reservations` (id, user_id, bike_id, created_at, expires_at, status)
- [ ] Frontend: Reserve button on map marker, countdown timer, cancel button
- [ ] Frontend error: "Bike already reserved" if booking conflicts

## Blocked by

- Blocked by #2 (Authentication - needs user context)
- Blocked by #3 (Inventory - needs bikes)
- Blocked by #4 (Geolocation - user has selected bike)

## User stories addressed

- User story 3: Reserve bike for 5 minutes
- User story 4: Cancel reservation before arriving

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.