bulk delete incoming letter
This commit is contained in:
@@ -352,6 +352,32 @@ func (p *LetterProcessorImpl) SoftDeleteIncomingLetter(ctx context.Context, id u
|
||||
})
|
||||
}
|
||||
|
||||
func (p *LetterProcessorImpl) BulkSoftDeleteIncomingLetters(ctx context.Context, ids []uuid.UUID) error {
|
||||
if len(ids) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return p.txManager.WithTransaction(ctx, func(txCtx context.Context) error {
|
||||
if err := p.letterRepo.BulkSoftDelete(txCtx, ids); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if p.activity != nil {
|
||||
userID := appcontext.FromGinContext(txCtx).UserID
|
||||
action := "letter.bulk_deleted"
|
||||
|
||||
// Log activity untuk setiap letter yang dihapus
|
||||
for _, id := range ids {
|
||||
if err := p.activity.Log(txCtx, id, action, &userID, nil, nil, nil, nil, nil, map[string]interface{}{}); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// CreateDispositions creates a new disposition with modular helper functions
|
||||
func (p *LetterProcessorImpl) CreateDispositions(ctx context.Context, req *contract.CreateLetterDispositionRequest) (*contract.ListDispositionsResponse, error) {
|
||||
// Transaction should be handled at service layer
|
||||
|
||||
Reference in New Issue
Block a user