Compare commits

..

5 Commits

Author SHA1 Message Date
3736c9d8f0 version: 1.0.149 2026-05-21 19:04:00 -04:00
ccca9129b2 added uuid.condition to filters 2026-05-21 19:03:31 -04:00
333fc69735 version: 1.0.148 2026-05-21 13:26:18 -04:00
b0fc6c12ef fixed queryer issue with nested families 2026-05-21 13:26:07 -04:00
0d14162ef4 version: 1.0.147 2026-05-20 19:12:03 -04:00
7 changed files with 141 additions and 1 deletions

View File

@ -70,6 +70,10 @@
"type": "string", "type": "string",
"format": "date-time" "format": "date-time"
}, },
"uuid_field": {
"type": "string",
"format": "uuid"
},
"tags": { "tags": {
"type": "array", "type": "array",
"items": { "items": {
@ -181,6 +185,17 @@
] ]
} }
} }
},
"uuid.condition": {
"type": "condition",
"properties": {
"$eq": {
"type": [
"string",
"null"
]
}
}
} }
} }
} }
@ -244,6 +259,7 @@
"billing_address", "billing_address",
"gender", "gender",
"birth_date", "birth_date",
"uuid_field",
"tags", "tags",
"ad_hoc", "ad_hoc",
"$and", "$and",
@ -258,6 +274,7 @@
"billing_address", "billing_address",
"gender", "gender",
"birth_date", "birth_date",
"uuid_field",
"tags", "tags",
"ad_hoc", "ad_hoc",
"$and", "$and",
@ -278,6 +295,7 @@
"billing_address", "billing_address",
"gender", "gender",
"birth_date", "birth_date",
"uuid_field",
"tags", "tags",
"ad_hoc", "ad_hoc",
"$and", "$and",
@ -325,6 +343,12 @@
"null" "null"
] ]
}, },
"uuid_field": {
"type": [
"uuid.condition",
"null"
]
},
"first_name": { "first_name": {
"type": [ "type": [
"string.condition", "string.condition",
@ -396,6 +420,7 @@
"string.condition": {}, "string.condition": {},
"integer.condition": {}, "integer.condition": {},
"date.condition": {}, "date.condition": {},
"uuid.condition": {},
"search": {}, "search": {},
"search.filter": { "search.filter": {
"type": "filter", "type": "filter",

View File

@ -59,6 +59,17 @@
} }
} }
} }
},
{
"name": "get_counterparty_orders",
"schemas": {
"get_counterparty_orders.response": {
"type": "array",
"items": {
"type": "counterparty.order"
}
}
}
} }
], ],
"enums": [], "enums": [],
@ -734,6 +745,14 @@
} }
} }
}, },
"counterparty.order": {
"type": "order",
"properties": {
"counterparty": {
"family": "organization"
}
}
},
"light.order": { "light.order": {
"type": "order", "type": "order",
"properties": { "properties": {
@ -2332,6 +2351,92 @@
] ]
] ]
} }
},
{
"description": "Order select with nested polymorphic counterparty family relation",
"action": "query",
"schema_id": "get_counterparty_orders.response",
"expect": {
"success": true,
"sql": [
[
"((SELECT jsonb_strip_nulls((",
" SELECT COALESCE(jsonb_agg(jsonb_build_object(",
" 'id', order_1.id,",
" 'type', order_1.type,",
" 'archived', entity_2.archived,",
" 'created_at', entity_2.created_at,",
" 'total', order_1.total,",
" 'customer_id', order_1.customer_id,",
" 'counterparty', (",
" SELECT CASE",
" WHEN organization_3.type = 'bot' THEN ((",
" SELECT jsonb_build_object(",
" 'id', entity_7.id,",
" 'type', entity_7.type,",
" 'archived', entity_7.archived,",
" 'created_at', entity_7.created_at,",
" 'name', organization_6.name,",
" 'token', bot_5.token,",
" 'role', bot_5.role",
" )",
" FROM agreego.bot bot_5",
" JOIN agreego.organization organization_6 ON organization_6.id = bot_5.id",
" JOIN agreego.entity entity_7 ON entity_7.id = organization_6.id",
" WHERE",
" NOT entity_7.archived",
" AND entity_7.id = entity_4.id",
" ))",
" WHEN organization_3.type = 'organization' THEN ((",
" SELECT jsonb_build_object(",
" 'id', entity_9.id,",
" 'type', entity_9.type,",
" 'archived', entity_9.archived,",
" 'created_at', entity_9.created_at,",
" 'name', organization_8.name",
" )",
" FROM agreego.organization organization_8",
" JOIN agreego.entity entity_9 ON entity_9.id = organization_8.id",
" WHERE",
" NOT entity_9.archived",
" AND entity_9.id = entity_4.id",
" ))",
" WHEN organization_3.type = 'person' THEN ((",
" SELECT jsonb_build_object(",
" 'id', entity_12.id,",
" 'type', entity_12.type,",
" 'archived', entity_12.archived,",
" 'created_at', entity_12.created_at,",
" 'name', organization_11.name,",
" 'first_name', person_10.first_name,",
" 'last_name', person_10.last_name,",
" 'age', person_10.age",
" )",
" FROM agreego.person person_10",
" JOIN agreego.organization organization_11 ON organization_11.id = person_10.id",
" JOIN agreego.entity entity_12 ON entity_12.id = organization_11.id",
" WHERE",
" NOT entity_12.archived",
" AND entity_12.id = entity_4.id",
" ))",
" ELSE NULL",
" END",
" FROM agreego.organization organization_3",
" JOIN agreego.entity entity_4 ON entity_4.id = organization_3.id",
" WHERE",
" NOT entity_4.archived",
" AND order_1.counterparty_id = entity_4.id",
" )",
" )), '[]'::jsonb)",
" FROM agreego.order order_1",
" JOIN agreego.entity entity_2 ON entity_2.id = order_1.id",
" WHERE",
" NOT entity_2.archived",
" AND order_1.counterparty_type = 'organization'",
"))))"
]
]
}
} }
] ]
} }

View File

@ -141,6 +141,8 @@ impl Schema {
if let Some(fmt) = &schema.obj.format { if let Some(fmt) = &schema.obj.format {
if fmt == "date-time" { if fmt == "date-time" {
return Some(vec!["date.condition".to_string()]); return Some(vec!["date.condition".to_string()]);
} else if fmt == "uuid" {
return Some(vec!["uuid.condition".to_string()]);
} }
} }
Some(vec!["string.condition".to_string()]) Some(vec!["string.condition".to_string()])

View File

@ -2,6 +2,7 @@ use std::collections::{HashMap, HashSet};
use serde_json::Value; use serde_json::Value;
pub fn compose(val: &mut Value, errors: &mut Vec<crate::drop::Error>) -> Result<(), String> { pub fn compose(val: &mut Value, errors: &mut Vec<crate::drop::Error>) -> Result<(), String> {
let _ = std::fs::write("/Users/awgneo/Repositories/thoughtpatterns/cellular/jspg/traits_debug_val.json", serde_json::to_string_pretty(val).unwrap());
let mut traits = HashMap::new(); let mut traits = HashMap::new();
let mut schemas = HashMap::new(); let mut schemas = HashMap::new();

View File

@ -213,6 +213,7 @@ impl<'a> Compiler<'a> {
let mut case_node = node.clone(); let mut case_node = node.clone();
case_node.parent_alias = base_alias.clone(); case_node.parent_alias = base_alias.clone();
case_node.property_name = None;
let arc_aliases = std::sync::Arc::new(table_aliases.clone()); let arc_aliases = std::sync::Arc::new(table_aliases.clone());
case_node.parent_type_aliases = Some(arc_aliases); case_node.parent_type_aliases = Some(arc_aliases);
case_node.parent_type = Some(r#type); case_node.parent_type = Some(r#type);

View File

@ -1499,6 +1499,12 @@ fn test_queryer_0_14() {
crate::tests::runner::run_test_case(&path, 0, 14).unwrap(); crate::tests::runner::run_test_case(&path, 0, 14).unwrap();
} }
#[test]
fn test_queryer_0_15() {
let path = format!("{}/fixtures/queryer.json", env!("CARGO_MANIFEST_DIR"));
crate::tests::runner::run_test_case(&path, 0, 15).unwrap();
}
#[test] #[test]
fn test_polymorphism_0_0() { fn test_polymorphism_0_0() {
let path = format!("{}/fixtures/polymorphism.json", env!("CARGO_MANIFEST_DIR")); let path = format!("{}/fixtures/polymorphism.json", env!("CARGO_MANIFEST_DIR"));

View File

@ -1 +1 @@
1.0.146 1.0.149