Compare commits

...

6 Commits

Author SHA1 Message Date
Ankur Malik
744c55a615 Map UPRWebNew to Direct New
All checks were successful
Build and Push Docker Image / setup (push) Successful in 4s
Build and Push Docker Image / build_and_push (push) Successful in 33s
2026-05-21 14:20:06 -04:00
3d0f92e462 Update config.json
All checks were successful
Build and Push Docker Image / setup (push) Successful in 4s
Build and Push Docker Image / build_and_push (push) Successful in 26s
2025-11-24 06:11:59 +00:00
8c80e94871 Update README.md
All checks were successful
Build and Push Docker Image / setup (push) Successful in 4s
Build and Push Docker Image / build_and_push (push) Successful in 26s
2025-04-07 18:20:10 +00:00
aa045b7d39 Update README.md
All checks were successful
Build and Push Docker Image / setup (push) Successful in 4s
Build and Push Docker Image / build_and_push (push) Successful in 29s
2025-04-07 17:58:08 +00:00
b0c6bfe3dc Push to db block
All checks were successful
Build and Push Docker Image / setup (push) Successful in 4s
Build and Push Docker Image / build_and_push (push) Successful in 27s
2025-03-12 17:25:54 +00:00
8471f32690 Push to db block
All checks were successful
Build and Push Docker Image / setup (push) Successful in 3s
Build and Push Docker Image / build_and_push (push) Successful in 39s
2025-03-12 16:18:21 +00:00
6 changed files with 116 additions and 6 deletions

View File

@ -1 +1 @@
**Hello world!!!** # Block for DB operations like lookup, insert, update etc.

View File

@ -1,6 +1,14 @@
[ [
{ {
"namespace": "", "namespace": "staging",
"connectionId": "" "connectionId": "56be80f8-7139-466f-b883-e4a695812d52"
},
{
"namespace": "production",
"connectionId": "cf2344a8-28d3-4b38-9456-ba9e5c347bf5"
},
{
"namespace": "production-beta",
"connectionId": "cf2344a8-28d3-4b38-9456-ba9e5c347bf5"
} }
] ]

View File

@ -1 +1,32 @@
Select * from dummy_table limit 10; INSERT INTO public.applications (
application_key,
application_timestamp,
application_ssn,
application_email_address,
application_bank_account_number,
application_is_rejected,
application_date_of_birth,
application_customer_type
)
VALUES (
$application_key,
$application_timestamp,
$application_ssn,
$application_email_address,
$application_bank_account_number,
$application_is_rejected,
$application_date_of_birth,
CASE
WHEN LOWER(TRIM($application_customer_type::text)) = 'uprwebnew' THEN 'Direct New'
ELSE $application_customer_type
END
)
ON CONFLICT (application_key)
DO UPDATE
SET application_timestamp = EXCLUDED.application_timestamp,
application_ssn = EXCLUDED.application_ssn,
application_email_address = EXCLUDED.application_email_address,
application_bank_account_number = EXCLUDED.application_bank_account_number,
application_is_rejected = EXCLUDED.application_is_rejected,
application_date_of_birth = EXCLUDED.application_date_of_birth,
application_customer_type = EXCLUDED.application_customer_type;

View File

@ -1 +1,38 @@
{} {
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"properties": {
"application_key": {
"type": "string"
},
"application_timestamp": {
"type": "string",
"format": "date-time"
},
"application_ssn": {
"type": ["string", "null"]
},
"application_email_address": {
"type": ["string", "null"],
"format": "email"
},
"application_bank_account_number": {
"type": ["string", "null"]
},
"application_is_rejected": {
"type": ["boolean", "null"],
"default": false
},
"application_date_of_birth": {
"type": ["string", "null"],
"format": "date"
},
"application_customer_type": {
"type": ["string", "null"]
}
},
"required": [
"application_key",
"application_timestamp"
]
}

View File

@ -1 +1,13 @@
{} {
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"properties": {
"result": {
"type": ["string", "null"]
},
"error": {
"type": ["string", "null"]
}
},
"required": []
}

22
test_block.py Normal file
View File

@ -0,0 +1,22 @@
import json
import unittest
from pathlib import Path
BLOCK_DIR = Path(__file__).resolve().parent
class TestDbPushV1SqlContract(unittest.TestCase):
def test_application_customer_type_direct_new_mapping(self):
schema = json.loads((BLOCK_DIR / "request_schema.json").read_text())
sql = (BLOCK_DIR / "main.sql").read_text().lower()
self.assertEqual(schema["properties"]["application_customer_type"]["type"], ["string", "null"])
self.assertNotIn("application_source_name", schema["properties"])
self.assertIn("$application_customer_type::text", sql)
self.assertIn("= 'uprwebnew' then 'direct new'", sql)
self.assertIn("else $application_customer_type", sql)
if __name__ == "__main__":
unittest.main()