feat(cars): catálogo de reserva, agendamento manual no admin e correç…#394
Conversation
…ões de filial - Reserva (/cars): exibe o catálogo de veículos direto (sem gate de filtro); ao reservar, pede o intervalo explícito (início + devolução) e aponta Disponível/Ocupado via nova query vehicleRent.checkAvailability. - Admin: agendamento manual em nome de outro usuário (vehicleRent.createForUser) + componente ManualRentForm; badge "Sem filial" nos veículos legados. - Corrige edição de veículo: empresa/filial agora vêm preenchidas (empresa derivada da filial salva, sem corrida de efeitos). - Backfill de filial para veículos legados quando o mapeamento é inequívoco. - Calendário de /cars: cada reserva ganha cor própria estendida por todo o intervalo (start → possibleEnd). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Deployment failed with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughThis PR adds an admin manual rent scheduling feature (new ChangesVehicle Rental Enhancements
Sequence Diagram(s)sequenceDiagram
participant Admin as Admin User
participant AdminPage as Admin Vehicles Page
participant ManualRentForm as ManualRentForm
participant vehicleRentRouter as vehicleRentRouter
participant DB as Database
Admin->>AdminPage: clicks "Novo Agendamento"
AdminPage->>ManualRentForm: opens Dialog
Admin->>ManualRentForm: searches user, selects vehicle, sets dates
ManualRentForm->>vehicleRentRouter: createForUser(userId, vehicleId, dates, details)
vehicleRentRouter->>vehicleRentRouter: hasAdminAccess check
vehicleRentRouter->>DB: validate target userId
vehicleRentRouter->>DB: $transaction — conflict check + create vehicleRent
DB-->>vehicleRentRouter: vehicleRent record
vehicleRentRouter-->>ManualRentForm: success
ManualRentForm-->>AdminPage: onSuccess → close Dialog + refetch
sequenceDiagram
participant User as User
participant RentForm as RentForm
participant vehicleRentRouter as vehicleRentRouter
participant DB as Database
User->>RentForm: selects vehicle + dates
RentForm->>vehicleRentRouter: checkAvailability(vehicleId, start, end)
vehicleRentRouter->>DB: query overlapping unfinished rents
DB-->>vehicleRentRouter: conflict or null
vehicleRentRouter-->>RentForm: available / occupied + reason
RentForm->>RentForm: show availability badge (loading/occupied/available)
alt Vehicle is occupied
User->>RentForm: clicks submit
RentForm->>RentForm: show "Veículo ocupado" toast, block submit
else Vehicle is available
User->>RentForm: clicks submit
RentForm->>vehicleRentRouter: create(startDate, endDate, ...)
vehicleRentRouter-->>RentForm: vehicleRent created
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ões de filial
Summary by CodeRabbit
Release Notes
New Features
Version