more filter fixes

This commit is contained in:
2026-04-17 07:43:19 -04:00
parent c2267b68d8
commit 69bd726b25
10 changed files with 75 additions and 26 deletions

View File

@ -1,6 +1,6 @@
use crate::database::Database;
use crate::database::object::{SchemaObject, SchemaTypeOrArray};
use crate::database::schema::Schema;
use crate::database::Database;
use std::collections::BTreeMap;
use std::sync::Arc;
@ -20,16 +20,26 @@ impl Schema {
let mut child_obj = SchemaObject::default();
child_obj.type_ = Some(SchemaTypeOrArray::Multiple(filter_type));
filter_props.insert(key.clone(), Arc::new(Schema { obj: child_obj, always_fail: false }));
filter_props.insert(
key.clone(),
Arc::new(Schema {
obj: child_obj,
always_fail: false,
}),
);
}
}
if !filter_props.is_empty() {
let mut wrapper_obj = SchemaObject::default();
wrapper_obj.type_ = Some(SchemaTypeOrArray::Single("object".to_string()));
// Conceptually link this directly into the STI lineage of the base `filter` object
wrapper_obj.type_ = Some(SchemaTypeOrArray::Single("filter".to_string()));
wrapper_obj.properties = Some(filter_props);
return Some(Schema { obj: wrapper_obj, always_fail: false });
return Some(Schema {
obj: wrapper_obj,
always_fail: false,
});
}
}
None

View File

@ -1,6 +1,6 @@
pub mod collection;
pub mod edges;
pub mod filters;
pub mod filter;
pub mod polymorphism;
use crate::database::schema::Schema;

View File

@ -15,6 +15,7 @@ pub struct Punc {
pub public: bool,
pub form: bool,
pub get: Option<String>,
pub save: Option<String>,
pub page: Option<Page>,
#[serde(default)]
pub schemas: std::collections::BTreeMap<String, Arc<Schema>>,

View File

@ -3,6 +3,8 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(default)]
pub struct Relation {
pub id: String,
pub r#type: String,
pub constraint: String,
pub source_type: String,
pub source_columns: Vec<String>,