[Invoices] - Create Database Interface File and Structure #116

Closed
opened 2025-11-05 20:33:58 +00:00 by duarteneves5 · 0 comments
duarteneves5 commented 2025-11-05 20:33:58 +00:00 (Migrated from github.com)

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

Tasks:

  • Create a new file (e.g., repositories/invoice_repo.py or services/invoice_service.py).
  • Define the class (e.g., InvoiceRepository).
  • Add placeholder/empty async methods for CRUD operations:
    • create_invoice(invoice_data: InvoiceCreate) -> Invoice
    • get_invoice_by_id(invoice_id: ObjectId) -> Invoice | None
    • get_invoices_by_client_id(client_id: ObjectId) -> list[Invoice]
    • get_invoices_by_workOrder_id(workOrder_id: ObjectId) -> list[Invoice]
    • update_invoice(invoice_id: ObjectId, update_data: InvoiceUpdate) -> Invoice | None
    • delete_invoice(invoice_id: ObjectId) -> bool
Create the file that will hold all database interactions for the `invoices` collection. This isolates our database logic from the API endpoints. **Tasks:** - [ ] Create a new file (e.g., `repositories/invoice_repo.py` or `services/invoice_service.py`). - [ ] Define the class (e.g., `InvoiceRepository`). - [ ] Add placeholder/empty `async` methods for CRUD operations: - `create_invoice(invoice_data: InvoiceCreate) -> Invoice` - `get_invoice_by_id(invoice_id: ObjectId) -> Invoice | None` - `get_invoices_by_client_id(client_id: ObjectId) -> list[Invoice]` - `get_invoices_by_workOrder_id(workOrder_id: ObjectId) -> list[Invoice]` - `update_invoice(invoice_id: ObjectId, update_data: InvoiceUpdate) -> Invoice | None` - `delete_invoice(invoice_id: ObjectId) -> bool`
Sign in to join this conversation.
No description provided.