added soft deleted
This commit is contained in:
1 parent
d1a6fcaadc
commit
e0d03730de
36 files changed
+327
-217
No files matched your search
@@ -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))
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user