[WorkOrders] - Create Database Interface File and Structure #111

Closed
opened 2025-11-05 19:53:58 +00:00 by duarteneves5 · 1 comment
duarteneves5 commented 2025-11-05 19:53:58 +00:00 (Migrated from github.com)

Create the file that will hold all database interactions for the workOrders collection. This isolates our database logic from the API endpoints.

Tasks:

  • Create a new file (e.g., repositories/workOrders_repo.py or services/workOrder_service.py).
  • Define the class (e.g., WorkOrderRepository).
  • Add placeholder/empty async methods for CRUD operations:
    • create_workOrder(workOrder_data: WorkOrderCreate) -> WorkOrder
    • get_workOrder_by_id(workOrder_id: ObjectId) -> WorkOrder | None
    • get_workOrders_by_vehicle_id(vehicle_id: str) -> list[WorkOrder]
    • get_workOrders_by_appointment_id(appointment_id: str) -> list[WorkOrder]
    • get_workOrders_by_client_id(client_id: ObjectId) -> list[WorkOrder]
    • update_workOrder(workOrder_id: ObjectId, update_data: WorkOrderUpdate) -> WorkOrder | None
    • delete_workOrder(workOrder_id: ObjectId) -> bool
Create the file that will hold all database interactions for the `workOrders` collection. This isolates our database logic from the API endpoints. **Tasks:** - [x] Create a new file (e.g., `repositories/workOrders_repo.py` or `services/workOrder_service.py`). - [x] Define the class (e.g., `WorkOrderRepository`). - [x] Add placeholder/empty `async` methods for CRUD operations: - `create_workOrder(workOrder_data: WorkOrderCreate) -> WorkOrder` - `get_workOrder_by_id(workOrder_id: ObjectId) -> WorkOrder | None` - `get_workOrders_by_vehicle_id(vehicle_id: str) -> list[WorkOrder]` - `get_workOrders_by_appointment_id(appointment_id: str) -> list[WorkOrder]` - `get_workOrders_by_client_id(client_id: ObjectId) -> list[WorkOrder]` - `update_workOrder(workOrder_id: ObjectId, update_data: WorkOrderUpdate) -> WorkOrder | None` - `delete_workOrder(workOrder_id: ObjectId) -> bool`
GFMpt13 commented 2025-11-07 13:13:13 +00:00 (Migrated from github.com)

get_workOrders_by_appointment_id(appointment_id: str) -> list[WorkOrder] should be address in the routes files. Adding this here would break the Single Responsibility Principle and creates a complex dependency that makes the code hard to test and maintain.

get_workOrders_by_appointment_id(appointment_id: str) -> list[WorkOrder] should be address in the routes files. Adding this here would break the Single Responsibility Principle and creates a complex dependency that makes the code hard to test and maintain.
Sign in to join this conversation.
No description provided.