surat keluar approval
This commit is contained in:
@@ -23,6 +23,7 @@ type NotificationProcessor interface {
|
||||
|
||||
// Letter notifications
|
||||
SendIncomingLetterNotification(ctx context.Context, letterID uuid.UUID, recipientUserID uuid.UUID, subject string, body string) error
|
||||
SendOutgoingLetterNotification(ctx context.Context, letterID uuid.UUID, recipientUserID uuid.UUID, subject string, body string) error
|
||||
}
|
||||
|
||||
type NotificationProcessorImpl struct {
|
||||
@@ -359,3 +360,30 @@ func (p *NovuProvider) SendNotification(ctx context.Context, payload Notificatio
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *NotificationProcessorImpl) SendOutgoingLetterNotification(ctx context.Context, letterID uuid.UUID, recipientUserID uuid.UUID, subject string, body string) error {
|
||||
// Ensure subscriber exists
|
||||
if err := p.provider.EnsureSubscriberExists(ctx, recipientUserID); err != nil {
|
||||
return fmt.Errorf("failed to ensure subscriber exists: %w", err)
|
||||
}
|
||||
|
||||
// Build notification URL for outgoing letters
|
||||
url := fmt.Sprintf("/en/apps/surat-menyurat/keluar-detail/%s", letterID.String())
|
||||
|
||||
// Use workflow ID from config (defaults to "notification-dashbpard")
|
||||
workflowID := p.workflowID
|
||||
if workflowID == "" {
|
||||
workflowID = "notification-dashbpard"
|
||||
}
|
||||
|
||||
// Send notification
|
||||
return p.provider.SendNotification(ctx, NotificationPayload{
|
||||
RecipientID: recipientUserID,
|
||||
EventName: workflowID,
|
||||
Data: map[string]interface{}{
|
||||
"subject": subject,
|
||||
"body": body,
|
||||
"url": url,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user