vehicles db interfacing layer #197

Merged
AndreFerreira5 merged 11 commits from db-interface-vehicles into main 2026-01-20 18:34:34 +00:00
AndreFerreira5 commented 2026-01-20 17:36:08 +00:00 (Migrated from github.com)

update main with vehicle repository code to continue development (the routes)

update main with vehicle repository code to continue development (the routes)
duarteneves5 (Migrated from github.com) reviewed 2026-01-20 17:36:08 +00:00
GFMpt13 (Migrated from github.com) reviewed 2026-01-20 17:36:08 +00:00
JoaoTF03 (Migrated from github.com) reviewed 2026-01-20 17:36:08 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2026-01-20 17:38:42 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull request overview

This pull request implements the vehicle repository database interfacing layer, replacing placeholder NotImplementedError implementations with functional CRUD operations using the Beanie ODM. The implementation includes comprehensive test coverage for all repository methods.

Changes:

  • Implemented all CRUD operations in VehicleRepo (create, read, update, delete)
  • Added error handling decorator to all repository methods
  • Changed logging level from info to debug for repository operations
  • Added comprehensive test suite covering all repository methods and edge cases

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/repository/vehicle.py Implemented all CRUD methods (create, get_by_id, get_by_license_plate, get_by_client_id, update, delete) with error handling decorator and debug logging
tests/test_repos/test_vehicles.py Added comprehensive test coverage for all repository methods including success cases, not found cases, and duplicate constraint violations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Pull request overview This pull request implements the vehicle repository database interfacing layer, replacing placeholder `NotImplementedError` implementations with functional CRUD operations using the Beanie ODM. The implementation includes comprehensive test coverage for all repository methods. **Changes:** - Implemented all CRUD operations in VehicleRepo (create, read, update, delete) - Added error handling decorator to all repository methods - Changed logging level from `info` to `debug` for repository operations - Added comprehensive test suite covering all repository methods and edge cases ### Reviewed changes Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment. | File | Description | | ---- | ----------- | | src/repository/vehicle.py | Implemented all CRUD methods (create, get_by_id, get_by_license_plate, get_by_client_id, update, delete) with error handling decorator and debug logging | | tests/test_repos/test_vehicles.py | Added comprehensive test coverage for all repository methods including success cases, not found cases, and duplicate constraint violations | --- 💡 <a href="/AndreFerreira5/starranja/new/main/.github/instructions?filename=*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
@ -0,0 +66,4 @@
brand="Other",
model="Car",
kilometers=10,
vin="1234567890ABCDEFG",
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-01-20 17:38:42 +00:00

The VIN value used in this test is the same as the sample_vehicle's VIN ("1234567890ABCDEFG"). Since both license_plate and vin have unique constraints in the Vehicle model, this test will fail due to duplicate VIN rather than duplicate license plate as intended. Change the VIN to a different value to properly test the duplicate license plate constraint.

        vin="ABCDEFGH123456789",
The VIN value used in this test is the same as the sample_vehicle's VIN ("1234567890ABCDEFG"). Since both license_plate and vin have unique constraints in the Vehicle model, this test will fail due to duplicate VIN rather than duplicate license plate as intended. Change the VIN to a different value to properly test the duplicate license plate constraint. ```suggestion vin="ABCDEFGH123456789", ```
vascodias23 (Migrated from github.com) approved these changes 2026-01-20 18:33:32 +00:00
vascodias23 (Migrated from github.com) left a comment

Apart from the small detail on test_create_vehicle_duplicate_license_plate, everything looks good!

Apart from the small detail on `test_create_vehicle_duplicate_license_plate`, everything looks good!
@ -0,0 +66,4 @@
brand="Other",
model="Car",
kilometers=10,
vin="1234567890ABCDEFG",
vascodias23 (Migrated from github.com) commented 2026-01-20 18:29:49 +00:00

True, the VIN needs changing here.

True, the VIN needs changing here.
Sign in to join this conversation.
No description provided.