[Appointments] Implementation (Router) #187

Closed
opened 2026-01-19 20:45:03 +00:00 by duarteneves5 · 0 comments
duarteneves5 commented 2026-01-19 20:45:03 +00:00 (Migrated from github.com)

Create src/routers/appointments.py.

Endpoints:

  • POST /: Create a new appointment.
    • Input: AppointmentCreate.
    • Logic: Call repo.create_appointment().
    • Note: Repo raises 404 if Client ID is invalid.
  • GET /{id}: Retrieve an appointment by ObjectId.
  • GET /: List appointments (Filters optional but recommended).
    • If ?client_id={val} -> Call repo.get_appointments_by_client_id.
    • If ?vehicle_id={val} -> Call repo.get_appointments_by_vehicle_id.
  • PATCH /{id}: Update appointment details.
    • Input: AppointmentUpdate.
    • Call repo.update_appointment().
  • DELETE /{id}: Delete appointment.
    • Call repo.delete_appointment().
Create `src/routers/appointments.py`. **Endpoints:** - **POST /**: Create a new appointment. - Input: `AppointmentCreate`. - Logic: Call `repo.create_appointment()`. - *Note*: Repo raises 404 if Client ID is invalid. - **GET /{id}**: Retrieve an appointment by ObjectId. - **GET /**: List appointments (Filters optional but recommended). - If `?client_id={val}` -> Call `repo.get_appointments_by_client_id`. - If `?vehicle_id={val}` -> Call `repo.get_appointments_by_vehicle_id`. - **PATCH /{id}**: Update appointment details. - Input: `AppointmentUpdate`. - Call `repo.update_appointment()`. - **DELETE /{id}**: Delete appointment. - Call `repo.delete_appointment()`.
Sign in to join this conversation.
No description provided.