added soft deleted
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled

This commit is contained in:
guwandyk committed 2026-09-05 17:58:23 +05:00
1 parent d1a6fcaadc
commit e0d03730de
36 files changed
+327 -217

No files matched your search

+2 -5
View File
@@ -77,7 +77,7 @@ func (r *repository) List(ctx context.Context, filter backup.ListFilter) (backup
}
func buildListQuery(filter backup.ListFilter) (whereClause string, args []interface{}) {
var conditions []string
conditions := []string{"b.deleted_at IS NULL"}
if filter.Search != "" {
args = append(args, shared.LikePattern(filter.Search))
@@ -89,9 +89,6 @@ func buildListQuery(filter backup.ListFilter) (whereClause string, args []interf
conditions = append(conditions, fmt.Sprintf("b.status = $%d", len(args)))
}
if len(conditions) == 0 {
return "", args
}
return " WHERE " + strings.Join(conditions, " AND "), args
}
@@ -103,7 +100,7 @@ func escapeLike(term string) string {
}
func (r *repository) GetByID(ctx context.Context, id int64) (backup.BackupDTO, error) {
query := `SELECT ` + backupSelectColumns + backupFromClause + ` WHERE b.id = $1`
query := `SELECT ` + backupSelectColumns + backupFromClause + ` WHERE b.id = $1 AND b.deleted_at IS NULL`
return scanBackupWithUser(r.client.QueryRow(ctx, query, id))
}