Fix/endpoints#43
Closed
Ke-vin-S wants to merge 3 commits into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes endpoints and updates field usage across the fleet module by renaming the vehicle “name” field to “model”, updating URL parameter names from pk to vehicle_id, and adding a new driver_assigned field.
- Renames vehicle name to model (views, serializers, tests, model, admin)
- Updates endpoint parameters to use vehicle_id instead of pk
- Adds a driver_assigned field with accompanying filtering and tests
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| logistics_core/settings.py | Adds dotenv support but duplicates BASE_DIR and leaves a debug print statement |
| fleet/views/vehicle.py | Updates endpoints to use vehicle_id and applies serializer changes |
| fleet/views/trip.py & fleet/views/fuel.py | Updates field reference from "name" to "model" |
| fleet/tests/test_vehicle_api.py & test_vehicle | Updates tests to reflect field renaming and URL changes |
| fleet/serializers/vehicle.py | Updates serializers for the new "model" field and introduces a location detail |
| fleet/serializers/init.py | Adjusts serializer imports and re-exports |
| fleet/models/core.py, migrations | Performs model field updates and adds driver_assigned field |
| fleet/admin.py | Updates admin display to use "model" instead of "name" |
| entrypoint.sh | Provides a fallback when running the Django server |
Files not reviewed (1)
- .idea/misc.xml: Language not supported
Comments suppressed due to low confidence (1)
fleet/serializers/vehicle.py:51
- VehicleLocation is used here without an explicit import; please add the necessary import statement for the VehicleLocation model.
history_qs = VehicleLocation.objects.filter(vehicle=obj).order_by('-timestamp')
|
|
||
| BASE_DIR = Path(__file__).resolve().parent.parent | ||
| # Build paths inside the project like this: BASE_DIR / 'subdir'. | ||
| BASE_DIR = Path(__file__).resolve().parent.parent |
There was a problem hiding this comment.
There is a duplicate assignment of BASE_DIR; please remove the redundant declaration to improve code clarity.
Suggested change
| BASE_DIR = Path(__file__).resolve().parent.parent |
| # SECURITY WARNING: don't run with debug turned on in production! | ||
| DEBUG = False | ||
|
|
||
| print(os.getenv('ALLOWED_HOSTS')) |
There was a problem hiding this comment.
A debug print statement is left in production code; consider removing it or wrapping it in a conditional based on the debug setting.
Suggested change
| print(os.getenv('ALLOWED_HOSTS')) | |
| if DEBUG: | |
| print(os.getenv('ALLOWED_HOSTS')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.