mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Compare commits
28 Commits
02b86be4c5
...
production
| Author | SHA1 | Date | |
|---|---|---|---|
| 621d0d2bfd | |||
| 32c34be2c6 | |||
| d2aa3ebac7 | |||
| 1fd3f96038 | |||
| cf0fc9e7e6 | |||
| d9041a89bb | |||
| c75281ebd9 | |||
| ca3ad810c6 | |||
| 655b1ad5fe | |||
| 84db5fe37a | |||
| 63a78da18d | |||
| ac50c06cd7 | |||
| b60649f59d | |||
| 6acc9416c1 | |||
| bb4e5d6e3e | |||
| 170c221957 | |||
| 812327f148 | |||
| cd192128f1 | |||
| a5d4d6c11d | |||
| 1452f8d083 | |||
| 33c6706181 | |||
| c9618e1095 | |||
| cae7f3ef63 | |||
| 42793d94bd | |||
| 1369bf0e36 | |||
| 361d14bd3e | |||
| 7923352535 | |||
| 010240066a |
@@ -542,9 +542,15 @@ func (s deliveryOrdersService) UpdateOne(c *fiber.Ctx, req *validation.DeliveryO
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
latestApproval, err := s.ApprovalSvc.LatestByTarget(c.Context(), utils.ApprovalWorkflowMarketing, id, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fiber.NewError(fiber.StatusInternalServerError, "Failed to check approval status")
|
||||||
|
}
|
||||||
|
|
||||||
err = s.MarketingRepo.DB().WithContext(c.Context()).Transaction(func(dbTransaction *gorm.DB) error {
|
err = s.MarketingRepo.DB().WithContext(c.Context()).Transaction(func(dbTransaction *gorm.DB) error {
|
||||||
marketingProductRepositoryTx := marketingRepo.NewMarketingProductRepository(dbTransaction)
|
marketingProductRepositoryTx := marketingRepo.NewMarketingProductRepository(dbTransaction)
|
||||||
marketingDeliveryProductRepositoryTx := marketingRepo.NewMarketingDeliveryProductRepository(dbTransaction)
|
marketingDeliveryProductRepositoryTx := marketingRepo.NewMarketingDeliveryProductRepository(dbTransaction)
|
||||||
|
approvalSvcTx := commonSvc.NewApprovalService(commonRepo.NewApprovalRepository(dbTransaction))
|
||||||
marketingRepoTx := marketingRepo.NewMarketingRepository(dbTransaction)
|
marketingRepoTx := marketingRepo.NewMarketingRepository(dbTransaction)
|
||||||
|
|
||||||
marketing, err := marketingRepoTx.GetByID(c.Context(), id, nil)
|
marketing, err := marketingRepoTx.GetByID(c.Context(), id, nil)
|
||||||
@@ -630,6 +636,23 @@ func (s deliveryOrdersService) UpdateOne(c *fiber.Ctx, req *validation.DeliveryO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if latestApproval != nil && latestApproval.StepNumber == uint16(utils.MarketingDeliveryOrder) {
|
||||||
|
action := entity.ApprovalActionUpdated
|
||||||
|
_, err := approvalSvcTx.CreateApproval(
|
||||||
|
c.Context(),
|
||||||
|
utils.ApprovalWorkflowMarketing,
|
||||||
|
id,
|
||||||
|
utils.MarketingStepSalesOrder,
|
||||||
|
&action,
|
||||||
|
actorID,
|
||||||
|
nil)
|
||||||
|
if err != nil {
|
||||||
|
if !errors.Is(err, gorm.ErrDuplicatedKey) {
|
||||||
|
return fiber.NewError(fiber.StatusInternalServerError, "Failed to reset approval to Sales Order")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -516,7 +516,7 @@ func (s salesOrdersService) UpdateOne(c *fiber.Ctx, req *validation.Update, id u
|
|||||||
c.Context(),
|
c.Context(),
|
||||||
utils.ApprovalWorkflowMarketing,
|
utils.ApprovalWorkflowMarketing,
|
||||||
id,
|
id,
|
||||||
approvalutils.ApprovalStep(latestApproval.StepNumber),
|
utils.MarketingStepPengajuan,
|
||||||
&action,
|
&action,
|
||||||
actorID,
|
actorID,
|
||||||
nil)
|
nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user