Skip to content

feat(backend): add review_status field and enforce Pending workflow#58

Open
tharjiha wants to merge 3 commits intomainfrom
feature/workrecord-review-status
Open

feat(backend): add review_status field and enforce Pending workflow#58
tharjiha wants to merge 3 commits intomainfrom
feature/workrecord-review-status

Conversation

@tharjiha
Copy link
Contributor

@tharjiha tharjiha commented Mar 8, 2026

Related Issue

Related to #53

Overview

This PR implements the foundation for the administrative review workflow for movement requests.

Changes

  • Added review_status field to ItemMovementRequest model
  • Created migration to update the database schema
  • Updated ItemMovementRequestSerializer to include review_status
  • Enforced review_status to default to PENDING on create and update operations

Behavior

  • All newly created movement requests are automatically marked as PENDING review
  • Any edits to existing requests reset the review_status to PENDING
  • The review_status field is read-only to prevent manual modification from the API

Purpose

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".

@tharjiha tharjiha requested review from qiuethan and vivjd March 8, 2026 03:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_status to ItemMovementRequest (model + migration).
  • Exposed review_status in ItemMovementRequestSerializer and 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
),
),
@vivjd
Copy link
Contributor

vivjd commented Mar 17, 2026

@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 review_status, we can just add a pending state to the current status field we have?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants