Creation of appointments Collection (RF02)` #85
Labels
No labels
CI/CD
MongoDB
PostgreSQL
api
authentication
bug
documentation
duplicate
enhancement
example issue
fix
good first issue
help wanted
high-level requirement
infrastructure
invalid
low-level requirement
medium-level requirement
question
security
test
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
AndreFerreira5/starranja#85
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This task involves designing a new collection,
appointments, to manage service bookings and the workshop's agenda. This directly supports the functional requirement RF02 ("Gerir marcações e agenda de serviços").This collection will link a client to a specific date and time, and optionally link to a vehicle and/a work order if they already exist.
Tasks
1. Define Schema:
clientId(Type:ObjectId, Required, Ref:clients): The client making the appointment.appointmentDate(Type:ISODate, Required): The date and time of the scheduled booking.vehicleId(Type:ObjectId, Optional, Ref:vehicles): The specific vehicle for the appointment.workOrderId(Type:ObjectId, Optional, Ref:workOrders): Links the appointment to an existing work order (e.g., for a follow-up or check-up).notes(Type:String, Optional): Client-provided notes or the service to be performed (e.g., "Check brakes," "Annual service," "Client reports noise").status(Type:String, Required): Enum:Scheduled,Completed,Canceled. Manages the appointment lifecycle.createdAt(Type:ISODate, Required): Standard document creation timestamp.updatedAt(Type:ISODate, Required): Standard document update timestamp.2. Define Schema Validation:
clientId,appointmentDate, andstatusare required.3. Define Indexes:
db.appointments.createIndex({ appointmentDate: -1 })(To quickly query the agenda, newest first).db.appointments.createIndex({ clientId: 1 })(To quickly find all appointments for a specific client).db.appointments.createIndex({ status: 1, appointmentDate: 1 })(Compound index to find appointments by status, sorted by date, e.g., "all 'Scheduled' appointments for the week").4. Update Documentation
5. Update Database with the new collection
appointments collection desing: