[Clients] - Create Database Interface File and Structure #97

Closed
opened 2025-11-03 17:37:10 +00:00 by GFMpt13 · 0 comments
GFMpt13 commented 2025-11-03 17:37:10 +00:00 (Migrated from github.com)

The first step is to create the file that will hold all database interactions for the clients collection. This isolates our database logic from the API endpoints.

Tasks:

  • Create a new file (e.g., repositories/client_repo.py or services/client_service.py).
  • Define the class (e.g., ClientRepository).
  • Add placeholder/empty async methods for CRUD operations:
    • create_client(client_data: ClientCreate) -> Client
    • get_client_by_id(client_id: ObjectId) -> Client | None
    • get_client_by_nif(nif: str) -> Client | None
    • update_client(client_id: ObjectId, update_data: ClientUpdate) -> Client | None
    • delete_client(client_id: ObjectId) -> bool
The first step is to create the file that will hold all database interactions for the `clients` collection. This isolates our database logic from the API endpoints. **Tasks:** - [x] Create a new file (e.g., `repositories/client_repo.py` or `services/client_service.py`). - [x] Define the class (e.g., `ClientRepository`). - [x] Add placeholder/empty `async` methods for CRUD operations: - `create_client(client_data: ClientCreate) -> Client` - `get_client_by_id(client_id: ObjectId) -> Client | None` - `get_client_by_nif(nif: str) -> Client | None` - `update_client(client_id: ObjectId, update_data: ClientUpdate) -> Client | None` - `delete_client(client_id: ObjectId) -> bool`
Sign in to join this conversation.
No description provided.