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

+3 -7
View File
@@ -135,7 +135,7 @@ func (r *repository) List(ctx context.Context, filter visamaster.ListFilter) (vi
}
func buildListQuery(filter visamaster.ListFilter) (whereClause string, args []interface{}) {
var conditions []string
conditions := []string{"o.deleted_at IS NULL"}
if filter.Name != "" {
args = append(args, shared.LikePattern(filter.Name))
@@ -168,15 +168,11 @@ func buildListQuery(filter visamaster.ListFilter) (whereClause string, args []in
conditions = append(conditions, fmt.Sprintf("o.region = $%d", len(args)))
}
if len(conditions) == 0 {
return "", args
}
return " WHERE " + strings.Join(conditions, " AND "), args
}
func (r *repository) GetByID(ctx context.Context, id int64) (visamaster.VisaMasterPaymentOrderDTO, error) {
query := `SELECT ` + orderSelectColumns + orderFromClause + ` WHERE o.id = $1`
query := `SELECT ` + orderSelectColumns + orderFromClause + ` WHERE o.id = $1 AND o.deleted_at IS NULL`
return scanOrder(r.client.QueryRow(ctx, query, id))
}
@@ -217,7 +213,7 @@ func (r *repository) Update(ctx context.Context, id int64, dto visamaster.Update
query := fmt.Sprintf(`
WITH updated AS (
UPDATE visa_master_payment_orders SET %s, updated_at = (CURRENT_TIMESTAMP AT TIME ZONE 'UTC')
WHERE id = $%d
WHERE id = $%d AND deleted_at IS NULL
RETURNING %s
)
SELECT %s