feat(backend): add review_status field and enforce Pending workflow#58
Open
feat(backend): add review_status field and enforce Pending workflow#58
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a review_status field to movement requests to support an administrative review workflow and forces the field back to PENDING on create/update via the API.
Changes:
- Added
review_statustoItemMovementRequest(model + migration). - Exposed
review_statusinItemMovementRequestSerializerand made it read-only. - Forced
review_status="PENDING"on serializer create/update.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| backend/movements/models.py | Introduces review_status choices/field on ItemMovementRequest. |
| backend/movements/serializers.py | Includes review_status in serialized output and forces PENDING on create/update. |
| backend/movements/migrations/0005_itemmovementrequest_review_status.py | Adds the DB column with default/choices. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
62
to
+68
| def create(self, validated_data): | ||
| # Volunteer is the logged-in user. | ||
| validated_data["review_status"] = "PENDING" | ||
| return super().create(validated_data) | ||
|
|
||
| def update(self, instance, validated_data): | ||
| validated_data["review_status"] = "PENDING" | ||
| return super().update(instance, validated_data) |
Comment on lines
62
to
+68
| def create(self, validated_data): | ||
| # Volunteer is the logged-in user. | ||
| validated_data["review_status"] = "PENDING" | ||
| return super().create(validated_data) | ||
|
|
||
| def update(self, instance, validated_data): | ||
| validated_data["review_status"] = "PENDING" | ||
| return super().update(instance, validated_data) |
Comment on lines
+19
to
+22
| REVIEW_STATUS_CHOICES = [ | ||
| ("PENDING", "Pending"), | ||
| ("APPROVED", "Approved"), | ||
| ] |
Comment on lines
34
to
+39
| status = models.CharField(max_length=20, choices=STATUS_CHOICES, default="WAITING_APPROVAL") | ||
| review_status = models.CharField( | ||
| max_length=10, | ||
| choices=REVIEW_STATUS_CHOICES, | ||
| default="PENDING", | ||
| ) |
Comment on lines
+13
to
+19
| migrations.AddField( | ||
| model_name="itemmovementrequest", | ||
| name="review_status", | ||
| field=models.CharField( | ||
| choices=[("PENDING", "Pending"), ("APPROVED", "Approved")], default="PENDING", max_length=10 | ||
| ), | ||
| ), |
Contributor
|
@qiuethan When I wrote the initial issue I might have been misleading about what we needed, but I think we don't need a separate |
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.
Related Issue
Related to #53
Overview
This PR implements the foundation for the administrative review workflow for movement requests.
Changes
review_statusfield toItemMovementRequestmodelItemMovementRequestSerializerto includereview_statusreview_statusto default toPENDINGon create and update operationsBehavior
PENDINGreviewreview_statustoPENDINGreview_statusfield is read-only to prevent manual modification from the APIPurpose
This ensures that no record can be added or edited without being flagged for admin review, supporting the system's goal of maintaining a reliable "Source of Truth".