implement archived

This commit is contained in:
Aditya Siregar 2025-09-21 19:21:12 +07:00
parent ca2acfd850
commit 90da195a2e

View File

@ -180,7 +180,6 @@ func (s *LetterOutgoingServiceImpl) CreateOutgoingLetter(ctx context.Context, re
go s.sendStepApprovalNotifications(context.Background(), result.ID, result.Subject, 1)
}
return transformLetterToResponse(result), nil
}
@ -242,7 +241,11 @@ func (s *LetterOutgoingServiceImpl) ListOutgoingLetters(ctx context.Context, req
}
}
archived := true
filter.IsArchived = &archived
if filter.IsArchived != nil {
filter.IsArchived = req.IsArchived
}
// Get raw letters data
letters, total, err := s.processor.ListOutgoingLetters(ctx, filter, req.Limit, offset)
@ -479,7 +482,7 @@ func (s *LetterOutgoingServiceImpl) ApproveOutgoingLetter(ctx context.Context, l
if s.notificationProcessor != nil {
// Step approved but not final - notify creator about step completion AND next approvers
creatorMessage := fmt.Sprintf("Surat keluar '%s' telah disetujui pada tahap %d, menunggu persetujuan tahap berikutnya", letter.Subject, currentApproval.StepOrder)
go s.sendApprovalNotificationToCreator(context.Background(), letterID, letter.CreatedBy, "Surat Keluar Disetujui Tahap " + fmt.Sprintf("%d", currentApproval.StepOrder), creatorMessage)
go s.sendApprovalNotificationToCreator(context.Background(), letterID, letter.CreatedBy, "Surat Keluar Disetujui Tahap "+fmt.Sprintf("%d", currentApproval.StepOrder), creatorMessage)
// Notify next step approvers
nextStepOrder := currentApproval.StepOrder + 1
@ -734,7 +737,6 @@ func (s *LetterOutgoingServiceImpl) CreateDiscussion(ctx context.Context, letter
go s.sendOutgoingDiscussionMentionNotifications(context.Background(), letterID, userID, req.Mentions, req.Message)
}
return transformDiscussionToResponse(result), nil
}