implement archived
This commit is contained in:
parent
ca2acfd850
commit
90da195a2e
@ -54,15 +54,15 @@ type LetterOutgoingService interface {
|
||||
}
|
||||
|
||||
type LetterOutgoingServiceImpl struct {
|
||||
processor processor.LetterOutgoingProcessor
|
||||
txManager *repository.TxManager
|
||||
validationProcessor processor.LetterValidationProcessor
|
||||
creationProcessor processor.LetterCreationProcessor
|
||||
approvalProcessor processor.LetterApprovalProcessor
|
||||
attachmentProcessor processor.LetterAttachmentProcessor
|
||||
recipientProcessor processor.LetterOutgoingRecipientProcessor
|
||||
processor processor.LetterOutgoingProcessor
|
||||
txManager *repository.TxManager
|
||||
validationProcessor processor.LetterValidationProcessor
|
||||
creationProcessor processor.LetterCreationProcessor
|
||||
approvalProcessor processor.LetterApprovalProcessor
|
||||
attachmentProcessor processor.LetterAttachmentProcessor
|
||||
recipientProcessor processor.LetterOutgoingRecipientProcessor
|
||||
notificationProcessor processor.NotificationProcessor
|
||||
activityProcessor processor.LetterActivityProcessor
|
||||
activityProcessor processor.LetterActivityProcessor
|
||||
}
|
||||
|
||||
func NewLetterOutgoingService(
|
||||
@ -77,15 +77,15 @@ func NewLetterOutgoingService(
|
||||
activityProcessor processor.LetterActivityProcessor,
|
||||
) *LetterOutgoingServiceImpl {
|
||||
return &LetterOutgoingServiceImpl{
|
||||
processor: processor,
|
||||
txManager: txManager,
|
||||
validationProcessor: validationProcessor,
|
||||
creationProcessor: creationProcessor,
|
||||
approvalProcessor: approvalProcessor,
|
||||
attachmentProcessor: attachmentProcessor,
|
||||
recipientProcessor: recipientProcessor,
|
||||
processor: processor,
|
||||
txManager: txManager,
|
||||
validationProcessor: validationProcessor,
|
||||
creationProcessor: creationProcessor,
|
||||
approvalProcessor: approvalProcessor,
|
||||
attachmentProcessor: attachmentProcessor,
|
||||
recipientProcessor: recipientProcessor,
|
||||
notificationProcessor: notificationProcessor,
|
||||
activityProcessor: activityProcessor,
|
||||
activityProcessor: activityProcessor,
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ func (s *LetterOutgoingServiceImpl) CreateOutgoingLetter(ctx context.Context, re
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Send notifications if letter needs approval
|
||||
// Send notifications if letter needs approval
|
||||
log.Printf("[DEBUG] createOutgoingLetter Finsig")
|
||||
log.Printf("[DEBUG] NotificationProcessor is nil: %v", s.notificationProcessor == nil)
|
||||
if s.notificationProcessor != nil && len(result.Approvals) > 0 {
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
filter.IsArchived = req.IsArchived
|
||||
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
|
||||
}
|
||||
|
||||
@ -1602,7 +1604,7 @@ func (s *LetterOutgoingServiceImpl) sendStepApprovalNotifications(ctx context.Co
|
||||
log.Printf("[DEBUG] Checking approval: Step=%d, Status=%s, ApproverID=%v",
|
||||
approval.StepOrder, approval.Status, approval.ApproverID)
|
||||
|
||||
if approval.StepOrder == stepOrder {
|
||||
if approval.StepOrder == stepOrder {
|
||||
log.Printf("[DEBUG] Sending notification to approver %s for step %d", approval.ApproverID.String(), stepOrder)
|
||||
|
||||
err := s.notificationProcessor.SendOutgoingLetterNotification(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user