[SupplierOrders] - Create Database Interface File and Structure #154

Closed
opened 2025-12-05 17:42:24 +00:00 by GFMpt13 · 0 comments
GFMpt13 commented 2025-12-05 17:42:24 +00:00 (Migrated from github.com)

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

Tasks:

  • Create a new file: src/repositories/supplier_order_repo.py.

  • Define the class: SupplierOrderRepo.

  • Add placeholder/empty async methods for CRUD operations (raising NotImplementedError):

  • create_supplier_order(order_data: SupplierOrderCreate, created_by_id: UUID) -> SupplierOrder

  • get_by_id(order_id: ObjectId) -> SupplierOrder | None

  • get_by_work_order_id(work_order_id: ObjectId) -> list[SupplierOrder] (To see parts ordered for a specific job)

  • get_by_status(status: SupplierOrderStatus) -> list[SupplierOrder] (For dashboard filtering)

  • get_by_supplier_name(supplier_name: str) -> list[SupplierOrder]

  • update(order_id: ObjectId, update_data: SupplierOrderUpdate) -> SupplierOrder | None

  • delete(order_id: ObjectId) -> bool

Create the file that will hold all database interactions for the supplierOrders collection. This isolates our database logic from the API endpoints. Tasks: - [x] Create a new file: src/repositories/supplier_order_repo.py. - [x] Define the class: SupplierOrderRepo. - [x] Add placeholder/empty async methods for CRUD operations (raising NotImplementedError): - create_supplier_order(order_data: SupplierOrderCreate, created_by_id: UUID) -> SupplierOrder - get_by_id(order_id: ObjectId) -> SupplierOrder | None - get_by_work_order_id(work_order_id: ObjectId) -> list[SupplierOrder] (To see parts ordered for a specific job) - get_by_status(status: SupplierOrderStatus) -> list[SupplierOrder] (For dashboard filtering) - get_by_supplier_name(supplier_name: str) -> list[SupplierOrder] - update(order_id: ObjectId, update_data: SupplierOrderUpdate) -> SupplierOrder | None - delete(order_id: ObjectId) -> bool
Sign in to join this conversation.
No description provided.