-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from GideonBature/main
Add Seed for escrow_transactions table 🌱 #48
- Loading branch information
Showing
2 changed files
with
157 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ INSERT INTO apartments ( | |
available_until | ||
) VALUES ( | ||
uuid_generate_v4(), | ||
(SELECT id FROM users WHERE email = '[email protected]'), | ||
(SELECT id FROM users WHERE email = '[email protected]' LIMIT 1), | ||
'Modern Loft in Heredia', | ||
'Spacious and bright loft in the heart of San José, perfect for professionals and digital nomads.', | ||
1250.00, | ||
|
@@ -27,7 +27,7 @@ INSERT INTO apartments ( | |
), | ||
( | ||
uuid_generate_v4(), | ||
(SELECT id FROM users WHERE email = '[email protected]'), | ||
(SELECT id FROM users WHERE email = '[email protected]' LIMIT 1), | ||
'Modern Loft in San Jose', | ||
'Spacious and bright loft in the heart of San José, perfect for professionals and digital nomads', | ||
1250.00, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
-- Seed for `escrow_transcations` table: | ||
|
||
INSERT INTO escrow_transactions ( | ||
id, | ||
bid_request_id, | ||
engagement_id, | ||
contract_id, | ||
signer_address, | ||
transaction_type, | ||
status, | ||
http_status_code, | ||
http_response_body, | ||
http_error_details, | ||
amount, | ||
initial_deposit_percentage, | ||
cancellation_reason, | ||
cancelled_by, | ||
refund_status, | ||
metadata, | ||
created_at, | ||
updated_at, | ||
completed_at | ||
) VALUES | ||
-- Scenario 1: Create escrow, pending status | ||
( | ||
uuid_generate_v4(), | ||
(SELECT id FROM bid_requests LIMIT 1 OFFSET 0), | ||
NULL, | ||
NULL, | ||
NULL, | ||
'CREATE_ESCROW', | ||
'PENDING', | ||
200, | ||
'{"message": "Escrow created"}'::jsonb, | ||
NULL, | ||
500.00, | ||
50, | ||
NULL, | ||
(SELECT id FROM users WHERE email = '[email protected]' LIMIT 1), | ||
NULL, | ||
'{"note": "Escrow created by user"}'::jsonb, | ||
NOW() - INTERVAL '2 days', | ||
NOW() - INTERVAL '1 day', | ||
NOW() | ||
), | ||
-- Scenario 2: Fund escrow, processing status | ||
( | ||
uuid_generate_v4(), | ||
(SELECT id FROM bid_requests LIMIT 1 OFFSET 1), | ||
NULL, | ||
'46bb85be-4d2c-49af-88dd-cd80f46b1502', | ||
NULL, | ||
'FUND_ESCROW', | ||
'PROCESSING', | ||
202, | ||
'{"message": "Escrow funded, processing transaction"}'::jsonb, | ||
NULL, | ||
300.00, | ||
50, | ||
NULL, | ||
(SELECT id FROM users WHERE email = '[email protected]' LIMIT 1), | ||
NULL, | ||
'{"note": "High priority"}'::jsonb, | ||
NOW() - INTERVAL '1 day', | ||
NOW(), | ||
NULL | ||
), | ||
-- Scenario 3: Complete escrow, completed status | ||
( | ||
uuid_generate_v4(), | ||
(SELECT id FROM bid_requests LIMIT 1 OFFSET 2), | ||
NULL, | ||
'2f6104ff-13c7-44e0-b778-32ab6b747b5a', | ||
NULL, | ||
'COMPLETE_ESCROW', | ||
'COMPLETED', | ||
400, | ||
'{"message": "Escrow completed successfully"}'::jsonb, | ||
NULL, | ||
400.00, | ||
50, | ||
NULL, | ||
(SELECT id FROM users WHERE email = '[email protected]' LIMIT 1), | ||
NULL, | ||
'{"note": "Final payment", "reason": "User request"}'::jsonb, | ||
NOW() - INTERVAL '4 days', | ||
NOW() - INTERVAL '3 days', | ||
NOW() - INTERVAL '2 days' | ||
), | ||
-- Scenario 4: Cancel escrow, cancelled status | ||
( | ||
uuid_generate_v4(), | ||
(SELECT id FROM bid_requests LIMIT 1 OFFSET 3), | ||
NULL, | ||
'd7c2578a-a30f-42f0-a7c5-fefe8f31815d', | ||
NULL, | ||
'CANCEL_ESCROW', | ||
'CANCELLED', | ||
400, | ||
'{"message": "Escrow cancelled"}'::jsonb, | ||
'{"error": "Insufficient funds"}'::jsonb, | ||
400.00, | ||
50, | ||
'Insufficient funds', | ||
(SELECT id FROM users WHERE email = '[email protected]' LIMIT 1), | ||
NULL, | ||
'{"note": "User request", "reason": "Insufficient funds"}'::jsonb, | ||
NOW() - INTERVAL '4 days', | ||
NOW() - INTERVAL '3 days', | ||
NOW() - INTERVAL '2 days' | ||
), | ||
-- Scenario 5: Refund escrow, refunded status | ||
( | ||
uuid_generate_v4(), | ||
(SELECT id FROM bid_requests LIMIT 1 OFFSET 4), | ||
NULL, | ||
NULL, | ||
NULL, | ||
'REFUND_ESCROW', | ||
'REFUNDED', | ||
206, | ||
'{"message": "Escrow refunded successfully"}'::jsonb, | ||
NULL, | ||
250.00, | ||
30, | ||
NULL, | ||
(SELECT id FROM users WHERE email = '[email protected]' LIMIT 1), | ||
'COMPLETED', | ||
'{"reason": "Refund issued"}'::jsonb, | ||
NOW() - INTERVAL '3 days', | ||
NOW() - INTERVAL '1 day', | ||
NOW() - INTERVAL '1 hour' | ||
), | ||
-- Scenario 6: Cancel escrow, failed status | ||
( | ||
uuid_generate_v4(), | ||
(SELECT id FROM bid_requests LIMIT 1 OFFSET 5), | ||
NULL, | ||
'94ad3e1d-453b-4399-a790-ad42bedd9350', | ||
NULL, | ||
'CANCEL_ESCROW', | ||
'FAILED', | ||
500, | ||
'{"message": "Escrow cancelled"}'::jsonb, | ||
'{"error": "Server error"}'::jsonb, | ||
250.00, | ||
50, | ||
'Server error', | ||
(SELECT id FROM users WHERE email = '[email protected]' LIMIT 1), | ||
NULL, | ||
'{"reason": "User request failed"}'::jsonb, | ||
NOW() - INTERVAL '4 days', | ||
NOW() - INTERVAL '3 days', | ||
NOW() - INTERVAL '2 days' | ||
); |