fixed another org id issue with merger
This commit is contained in:
@ -1806,6 +1806,7 @@
|
|||||||
" \"id\",",
|
" \"id\",",
|
||||||
" \"modified_at\",",
|
" \"modified_at\",",
|
||||||
" \"modified_by\",",
|
" \"modified_by\",",
|
||||||
|
" \"organization_id\",",
|
||||||
" \"type\"",
|
" \"type\"",
|
||||||
")",
|
")",
|
||||||
"VALUES (",
|
"VALUES (",
|
||||||
@ -1814,6 +1815,7 @@
|
|||||||
" '{{uuid:customer_id}}',",
|
" '{{uuid:customer_id}}',",
|
||||||
" '{{timestamp}}',",
|
" '{{timestamp}}',",
|
||||||
" '00000000-0000-0000-0000-000000000000',",
|
" '00000000-0000-0000-0000-000000000000',",
|
||||||
|
" 'ffffffff-ffff-ffff-ffff-ffffffffffff',",
|
||||||
" 'person'",
|
" 'person'",
|
||||||
")"
|
")"
|
||||||
],
|
],
|
||||||
@ -1869,6 +1871,7 @@
|
|||||||
" \"date_of_birth\":\"2000-01-01\",",
|
" \"date_of_birth\":\"2000-01-01\",",
|
||||||
" \"first_name\":\"Bob\",",
|
" \"first_name\":\"Bob\",",
|
||||||
" \"last_name\":\"Smith\",",
|
" \"last_name\":\"Smith\",",
|
||||||
|
" \"organization_id\":\"ffffffff-ffff-ffff-ffff-ffffffffffff\",",
|
||||||
" \"type\":\"person\"",
|
" \"type\":\"person\"",
|
||||||
" }',",
|
" }',",
|
||||||
" '{{uuid:customer_id}}',",
|
" '{{uuid:customer_id}}',",
|
||||||
@ -1964,12 +1967,14 @@
|
|||||||
" \"last_name\":\"Smith\",",
|
" \"last_name\":\"Smith\",",
|
||||||
" \"modified_at\":\"{{timestamp}}\",",
|
" \"modified_at\":\"{{timestamp}}\",",
|
||||||
" \"modified_by\":\"00000000-0000-0000-0000-000000000000\",",
|
" \"modified_by\":\"00000000-0000-0000-0000-000000000000\",",
|
||||||
|
" \"organization_id\":\"ffffffff-ffff-ffff-ffff-ffffffffffff\",",
|
||||||
" \"type\":\"person\"",
|
" \"type\":\"person\"",
|
||||||
" },",
|
" },",
|
||||||
" \"new\":{",
|
" \"new\":{",
|
||||||
" \"date_of_birth\":\"2000-01-01\",",
|
" \"date_of_birth\":\"2000-01-01\",",
|
||||||
" \"first_name\":\"Bob\",",
|
" \"first_name\":\"Bob\",",
|
||||||
" \"last_name\":\"Smith\",",
|
" \"last_name\":\"Smith\",",
|
||||||
|
" \"organization_id\":\"ffffffff-ffff-ffff-ffff-ffffffffffff\",",
|
||||||
" \"type\":\"person\"",
|
" \"type\":\"person\"",
|
||||||
" }",
|
" }",
|
||||||
" }')"
|
" }')"
|
||||||
@ -3368,6 +3373,7 @@
|
|||||||
" \"id\",",
|
" \"id\",",
|
||||||
" \"modified_at\",",
|
" \"modified_at\",",
|
||||||
" \"modified_by\",",
|
" \"modified_by\",",
|
||||||
|
" \"organization_id\",",
|
||||||
" \"type\"",
|
" \"type\"",
|
||||||
")",
|
")",
|
||||||
"VALUES (",
|
"VALUES (",
|
||||||
@ -3376,6 +3382,7 @@
|
|||||||
" '{{uuid:person_id}}',",
|
" '{{uuid:person_id}}',",
|
||||||
" '{{timestamp}}',",
|
" '{{timestamp}}',",
|
||||||
" '{{uuid}}',",
|
" '{{uuid}}',",
|
||||||
|
" 'ffffffff-ffff-ffff-ffff-ffffffffffff',",
|
||||||
" 'person'",
|
" 'person'",
|
||||||
")"
|
")"
|
||||||
],
|
],
|
||||||
@ -3428,6 +3435,7 @@
|
|||||||
" '{",
|
" '{",
|
||||||
" \"first_name\":\"Const\",",
|
" \"first_name\":\"Const\",",
|
||||||
" \"last_name\":\"Person\",",
|
" \"last_name\":\"Person\",",
|
||||||
|
" \"organization_id\":\"ffffffff-ffff-ffff-ffff-ffffffffffff\",",
|
||||||
" \"type\":\"person\"",
|
" \"type\":\"person\"",
|
||||||
" }',",
|
" }',",
|
||||||
" '{{uuid:person_id}}',",
|
" '{{uuid:person_id}}',",
|
||||||
@ -3634,11 +3642,13 @@
|
|||||||
" \"last_name\":\"Person\",",
|
" \"last_name\":\"Person\",",
|
||||||
" \"modified_at\":\"{{timestamp}}\",",
|
" \"modified_at\":\"{{timestamp}}\",",
|
||||||
" \"modified_by\":\"00000000-0000-0000-0000-000000000000\",",
|
" \"modified_by\":\"00000000-0000-0000-0000-000000000000\",",
|
||||||
|
" \"organization_id\":\"ffffffff-ffff-ffff-ffff-ffffffffffff\",",
|
||||||
" \"type\":\"person\"",
|
" \"type\":\"person\"",
|
||||||
" },",
|
" },",
|
||||||
" \"new\":{",
|
" \"new\":{",
|
||||||
" \"first_name\":\"Const\",",
|
" \"first_name\":\"Const\",",
|
||||||
" \"last_name\":\"Person\",",
|
" \"last_name\":\"Person\",",
|
||||||
|
" \"organization_id\":\"ffffffff-ffff-ffff-ffff-ffffffffffff\",",
|
||||||
" \"type\":\"person\"",
|
" \"type\":\"person\"",
|
||||||
" }",
|
" }",
|
||||||
" }')"
|
" }')"
|
||||||
|
|||||||
@ -135,14 +135,18 @@ impl Merger {
|
|||||||
schema: &Arc<crate::database::schema::Schema>,
|
schema: &Arc<crate::database::schema::Schema>,
|
||||||
) {
|
) {
|
||||||
if !relative.contains_key("organization_id") {
|
if !relative.contains_key("organization_id") {
|
||||||
if let Some(org_id) = entity_fields.get("organization_id") {
|
let mut const_val: Option<Value> = None;
|
||||||
if let Some(compiled_props) = schema.obj.compiled_properties.get() {
|
if let Some(compiled_props) = schema.obj.compiled_properties.get() {
|
||||||
if let Some(org_schema) = compiled_props.get("organization_id") {
|
if let Some(org_schema) = compiled_props.get("organization_id") {
|
||||||
if org_schema.obj.const_.is_some() {
|
if let Some(c) = &org_schema.obj.const_ {
|
||||||
return;
|
const_val = Some(c.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(c) = const_val {
|
||||||
|
relative.insert("organization_id".to_string(), c);
|
||||||
|
} else if let Some(org_id) = entity_fields.get("organization_id") {
|
||||||
relative.insert("organization_id".to_string(), org_id.clone());
|
relative.insert("organization_id".to_string(), org_id.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user