Enrich cards API responses with joined relations and share common helpers.
Some checks failed
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled

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:
2026-08-26 12:46:50 +05:00
parent 1fd0abbcb2
commit 0098422798
27 changed files with 942 additions and 777 deletions

View File

@@ -219,7 +219,7 @@ CREATE TABLE IF NOT EXISTS card_pin_orders (
user_id bigint,
card_type_id bigint NOT NULL,
card_number character varying(255),
region character varying(2) NOT NULL,
region character varying(255) NOT NULL,
branch_id bigint NOT NULL,
customer_name character varying(255) NOT NULL,
customer_surname character varying(255) NOT NULL,

View File

@@ -0,0 +1,3 @@
ALTER TABLE card_pin_orders
ALTER COLUMN region TYPE character varying(2)
USING LEFT(region, 2);

View File

@@ -0,0 +1,2 @@
ALTER TABLE card_pin_orders
ALTER COLUMN region TYPE character varying(255);

View File

@@ -500,7 +500,7 @@ INSERT INTO loan_orders (
loan_order_required_doc_id, status, satisfiable, notes
) VALUES
(
'LO-2026-0001', 'web', 9, 1, 'AG', 1,
'0001', 'mobile', 9, 1, 'AG', 1,
'Kerim', 'Atayew', 'Begliýewiç',
'Ashgabat, Bitaraplyk 20', 'Ashgabat, Bitaraplyk 20', 'I-AG', '101010',
'2017-01-15', 'Ashgabat City Police', 'Ashgabat', '1989-03-21',
@@ -517,7 +517,7 @@ INSERT INTO loan_orders (
1, 'pending', 'yes', 'Consumer loan application'
),
(
'LO-2026-0002', 'web', 10, 3, 'AG', 2,
'0002', 'mobile', 10, 3, 'AG', 2,
'Leyla', 'Gurbanowa', 'Saparowna',
'Ashgabat, Andalyp 8', 'Ashgabat, Andalyp 8', 'I-AG', '303030',
'2016-09-10', 'Ashgabat City Police', 'Ashgabat', '1994-08-02',
@@ -531,7 +531,7 @@ INSERT INTO loan_orders (
2, 'approved', 'yes', 'Auto loan approved'
),
(
'LO-2026-0003', 'branch', 7, 2, 'MR', 7,
'0003', 'mobile', 7, 2, 'MR', 7,
'Dovran', 'Annayew', 'Hojamyradowiç',
'Mary, Galkynyş 15', 'Mary, Galkynyş 15', 'I-MR', '112233',
'2012-04-22', 'Mary Police', 'Mary', '1995-01-25',
@@ -548,7 +548,7 @@ INSERT INTO loan_orders (
4, 'review', 'pending', 'Mortgage under review'
),
(
'LO-2026-0004', 'web', NULL, 4, 'LB', 6,
'0004', 'mobile', NULL, 4, 'LB', 6,
'Oguljenan', 'Çaryýewa', 'Myradowna',
'Turkmenabat, Magtymguly 2', 'Turkmenabat, Magtymguly 2', 'I-LB', '606060',
'2019-11-05', 'Turkmenabat Police', 'Turkmenabat', '1996-12-12',