Merge branch 'main' of https://gits.altru.id/ESLOGAD/eslogad-backend
This commit is contained in:
commit
8aadb06d40
@ -404,7 +404,7 @@ func (p *LetterOutgoingProcessorImpl) ProcessApprovalSubmission(ctx context.Cont
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
// Find the minimum step order (first step)
|
||||
minStepOrder := flow.Steps[0].StepOrder
|
||||
for _, step := range flow.Steps {
|
||||
@ -733,9 +733,9 @@ func (p *LetterOutgoingProcessorImpl) ProcessRejection(ctx context.Context, lett
|
||||
|
||||
for i := range allApprovals {
|
||||
// Only update other pending approvals from the same revision
|
||||
if allApprovals[i].RevisionNumber == approval.RevisionNumber &&
|
||||
allApprovals[i].ID != approval.ID &&
|
||||
allApprovals[i].Status == entities.ApprovalStatusPending {
|
||||
if allApprovals[i].RevisionNumber == approval.RevisionNumber &&
|
||||
allApprovals[i].ID != approval.ID &&
|
||||
allApprovals[i].Status == entities.ApprovalStatusPending {
|
||||
allApprovals[i].Status = entities.ApprovalStatusRejected
|
||||
if err := p.approvalRepo.Update(txCtx, &allApprovals[i]); err != nil {
|
||||
return err
|
||||
@ -785,10 +785,10 @@ func (p *LetterOutgoingProcessorImpl) ProcessRevision(ctx context.Context, lette
|
||||
|
||||
// Increment revision number
|
||||
letter.RevisionNumber++
|
||||
|
||||
|
||||
// Set revision number on the new attachment
|
||||
attachment.RevisionNumber = letter.RevisionNumber
|
||||
|
||||
|
||||
// Add the new attachment
|
||||
if err := p.attachmentRepo.Create(txCtx, &attachment); err != nil {
|
||||
return err
|
||||
@ -821,6 +821,7 @@ func (p *LetterOutgoingProcessorImpl) ProcessRevision(ctx context.Context, lette
|
||||
ParallelGroup: approval.ParallelGroup,
|
||||
IsRequired: approval.IsRequired,
|
||||
Status: entities.ApprovalStatusPending,
|
||||
ApproverID: approval.ApproverID,
|
||||
}
|
||||
if err := p.approvalRepo.Create(txCtx, &newApproval); err != nil {
|
||||
return err
|
||||
@ -897,12 +898,12 @@ func (p *LetterOutgoingProcessorImpl) AddAttachments(ctx context.Context, letter
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
// Set revision number on all attachments
|
||||
for i := range attachments {
|
||||
attachments[i].RevisionNumber = letter.RevisionNumber
|
||||
}
|
||||
|
||||
|
||||
if err := p.attachmentRepo.CreateBulk(txCtx, attachments); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -984,7 +985,7 @@ func (p *LetterOutgoingProcessorImpl) GetApprovalsByLetter(ctx context.Context,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
return p.GetApprovalsByLetterAndRevision(ctx, letterID, letter.RevisionNumber)
|
||||
}
|
||||
|
||||
@ -994,7 +995,7 @@ func (p *LetterOutgoingProcessorImpl) GetApprovalsByLetterAndRevision(ctx contex
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
// Filter to only return approvals for the specified revision
|
||||
var currentRevisionApprovals []entities.LetterOutgoingApproval
|
||||
for _, approval := range approvals {
|
||||
@ -1002,7 +1003,7 @@ func (p *LetterOutgoingProcessorImpl) GetApprovalsByLetterAndRevision(ctx contex
|
||||
currentRevisionApprovals = append(currentRevisionApprovals, approval)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return currentRevisionApprovals, nil
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user