[Vehicles] - Create Database Interface File and Structure #102

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

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

Tasks:

  • Create a new file (e.g., repositories/vehicle_repo.py or services/vehicle_service.py).
  • Define the class (e.g., VehicleRepository).
  • Add placeholder/empty async methods for CRUD operations:
    • create_vehicle(vehicle_data: VehicleCreate) -> Vehicle
    • get_vehicle_by_id(vehicle_id: ObjectId) -> Vehicle | None
    • get_vehicle_by_license_plate(license_plate: str) -> Vehicle | None
    • get_vehicles_by_client_id(client_id: ObjectId) -> list[Vehicle]
    • update_vehicle(vehicle_id: ObjectId, update_data: VehicleUpdate) -> Vehicle | None
    • delete_vehicle(vehicle_id: ObjectId) -> bool
Create the file that will hold all database interactions for the `vehicles` collection. This isolates our database logic from the API endpoints. **Tasks:** - [x] Create a new file (e.g., `repositories/vehicle_repo.py` or `services/vehicle_service.py`). - [x] Define the class (e.g., `VehicleRepository`). - [x] Add placeholder/empty `async` methods for CRUD operations: - `create_vehicle(vehicle_data: VehicleCreate) -> Vehicle` - `get_vehicle_by_id(vehicle_id: ObjectId) -> Vehicle | None` - `get_vehicle_by_license_plate(license_plate: str) -> Vehicle | None` - `get_vehicles_by_client_id(client_id: ObjectId) -> list[Vehicle]` - `update_vehicle(vehicle_id: ObjectId, update_data: VehicleUpdate) -> Vehicle | None` - `delete_vehicle(vehicle_id: ObjectId) -> bool`
Sign in to join this conversation.
No description provided.