beefed up schema compiled properties with cases properties and added tests with cases to queryer and merger
This commit is contained in:
@ -924,6 +924,91 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "account",
|
||||
"hierarchy": [
|
||||
"account",
|
||||
"entity"
|
||||
],
|
||||
"fields": [
|
||||
"id",
|
||||
"type",
|
||||
"kind",
|
||||
"archived",
|
||||
"created_at",
|
||||
"routing_number",
|
||||
"card_number"
|
||||
],
|
||||
"grouped_fields": {
|
||||
"entity": [
|
||||
"id",
|
||||
"type",
|
||||
"archived",
|
||||
"created_at"
|
||||
],
|
||||
"account": [
|
||||
"kind",
|
||||
"routing_number",
|
||||
"card_number"
|
||||
]
|
||||
},
|
||||
"field_types": {
|
||||
"id": "uuid",
|
||||
"type": "text",
|
||||
"kind": "text",
|
||||
"archived": "boolean",
|
||||
"created_at": "timestamptz",
|
||||
"routing_number": "text",
|
||||
"card_number": "text"
|
||||
},
|
||||
"variations": [
|
||||
"account"
|
||||
],
|
||||
"schemas": {
|
||||
"account": {
|
||||
"type": "entity",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"when": {
|
||||
"properties": {
|
||||
"kind": {
|
||||
"const": "checking"
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"routing_number": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"when": {
|
||||
"properties": {
|
||||
"kind": {
|
||||
"const": "credit"
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"card_number": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "invoice",
|
||||
"schemas": {
|
||||
@ -2149,6 +2234,30 @@
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Account select on full schema with cases fields",
|
||||
"action": "query",
|
||||
"schema_id": "account",
|
||||
"expect": {
|
||||
"success": true,
|
||||
"sql": [
|
||||
[
|
||||
"(SELECT jsonb_strip_nulls((SELECT jsonb_build_object(",
|
||||
" 'archived', entity_2.archived,",
|
||||
" 'card_number', account_1.card_number,",
|
||||
" 'created_at', entity_2.created_at,",
|
||||
" 'id', entity_2.id,",
|
||||
" 'kind', account_1.kind,",
|
||||
" 'routing_number', account_1.routing_number,",
|
||||
" 'type', entity_2.type",
|
||||
")",
|
||||
"FROM agreego.account account_1",
|
||||
"JOIN agreego.entity entity_2 ON entity_2.id = account_1.id",
|
||||
"WHERE NOT entity_2.archived)))"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user