bulk delete outgoing letter

This commit is contained in:
efrilm
2025-10-30 12:40:32 +07:00
parent 9e4481a0bd
commit 67b37a9c1e
6 changed files with 100 additions and 10 deletions
@@ -71,6 +71,16 @@ func (r *LetterOutgoingRepository) SoftDelete(ctx context.Context, id uuid.UUID)
return db.WithContext(ctx).Model(&entities.LetterOutgoing{}).Where("id = ? AND deleted_at IS NULL", id).Update("deleted_at", now).Error
}
func (r *LetterOutgoingRepository) BulkSoftDelete(ctx context.Context, ids []uuid.UUID) error {
if len(ids) == 0 {
return nil
}
db := DBFromContext(ctx, r.db)
now := time.Now()
return db.WithContext(ctx).Model(&entities.LetterOutgoing{}).Where("id IN ? AND deleted_at IS NULL", ids).Update("deleted_at", now).Error
}
func (r *LetterOutgoingRepository) BulkArchive(ctx context.Context, letterIDs []uuid.UUID) (int64, error) {
db := DBFromContext(ctx, r.db)
now := time.Now()