updates on the reverse logistics

This commit is contained in:
2026-10-06 11:05:03 +05:30
parent cb3108ffdb
commit 220e934045
10 changed files with 1541 additions and 8 deletions

View File

@@ -3166,6 +3166,13 @@ func AdminUpdateConsignmentStatus(c *fiber.Ctx) error {
return utils.NotFound(c, "consignment not found")
}
// Guard the move (reverse logistics plan, B1): this used to write any
// string onto any parcel, including Delivered onto a cancelled one.
if msg := checkGenericStatusChange(consignment.Status, req.Status); msg != "" {
tx.Rollback()
return utils.BadRequest(c, msg)
}
consignment.Status = req.Status
consignment.Updatedat = time.Now()
if err := tx.Save(&consignment).Error; err != nil {