Enrich cards API responses with joined relations and share common helpers.
Nest user/branch/cardType/cardState on card, order, pin-order, and visa-master reads; accept flexible dates/IDs on pin create; widen pin region; ignore undefined list query params; extract internal/cards/shared to remove duplicated types and helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
1fd0abbcb2
commit
0098422798
27 files changed
+942
-777
No files matched your search
@@ -196,9 +196,10 @@ func (r *repository) GetByID(ctx context.Context, id int64) (loanorders.LoanOrde
|
||||
return scanLoanOrder(r.client.QueryRow(ctx, query, id))
|
||||
}
|
||||
|
||||
// nextUniqueIDSQL computes unique_id as the last value stored in loan_orders plus
|
||||
// one, zero-padded to 4 digits, mirroring a serial/auto-increment column.
|
||||
const nextUniqueIDSQL = `(SELECT LPAD((COALESCE(MAX(unique_id::bigint), 0) + 1)::text, 4, '0') FROM loan_orders)`
|
||||
// nextUniqueIDSQL computes unique_id as the last numeric value stored in
|
||||
// loan_orders plus one, zero-padded to 4 digits. Non-numeric rows (e.g. legacy
|
||||
// "LO-2026-0001") are ignored so CREATE does not fail with a cast error.
|
||||
const nextUniqueIDSQL = `(SELECT LPAD((COALESCE(MAX(CASE WHEN unique_id ~ '^[0-9]+$' THEN unique_id::bigint END), 0) + 1)::text, 4, '0') FROM loan_orders)`
|
||||
|
||||
func (r *repository) Create(ctx context.Context, dto loanorders.CreateLoanOrderDTO) (loanorders.LoanOrderDTO, error) {
|
||||
// unique_id is supplied positionally via nextUniqueIDSQL below, so drop it
|
||||
|
||||
Reference in new issue
Block a user