FIX[BE]: fixing issue failed delivery order, fixing unique constraint sales order

This commit is contained in:
aguhh18
2025-11-24 14:35:20 +07:00
parent 1ceda3623e
commit 99688c8e11
7 changed files with 117 additions and 42 deletions
@@ -190,9 +190,6 @@ func (s *deliveryOrdersService) CreateOne(c *fiber.Ctx, req *validation.Create)
if latestApproval.StepNumber >= uint16(utils.MarketingDeliveryOrder) {
return nil, fiber.NewError(fiber.StatusBadRequest, "Delivery order already exists for this marketing")
}
if latestApproval.Action == nil || *latestApproval.Action != entity.ApprovalActionApproved {
return nil, fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("Marketing is not approved - current status: %v", *latestApproval.Action))
}
err = s.MarketingRepo.DB().WithContext(c.Context()).Transaction(func(dbTransaction *gorm.DB) error {