queryer fixes in place
This commit is contained in:
54
t10.json
Normal file
54
t10.json
Normal file
@ -0,0 +1,54 @@
|
||||
[
|
||||
[
|
||||
"(SELECT jsonb_build_object(",
|
||||
" 'id', organization_1.id,",
|
||||
" 'type', CASE",
|
||||
" WHEN organization_1.type = 'person' THEN",
|
||||
" ((SELECT jsonb_build_object(",
|
||||
" 'age', person_3.age,",
|
||||
" 'archived', entity_5.archived,",
|
||||
" 'created_at', entity_5.created_at,",
|
||||
" 'first_name', person_3.first_name,",
|
||||
" 'id', entity_5.id,",
|
||||
" 'last_name', person_3.last_name,",
|
||||
" 'name', entity_5.name,",
|
||||
" 'type', entity_5.type",
|
||||
" )",
|
||||
" FROM agreego.person person_3",
|
||||
" JOIN agreego.organization organization_4 ON organization_4.id = person_3.id",
|
||||
" JOIN agreego.entity entity_5 ON entity_5.id = organization_4.id",
|
||||
" WHERE",
|
||||
" NOT entity_5.archived))",
|
||||
" WHEN organization_1.type = 'bot' THEN",
|
||||
" ((SELECT jsonb_build_object(",
|
||||
" 'archived', entity_8.archived,",
|
||||
" 'created_at', entity_8.created_at,",
|
||||
" 'id', entity_8.id,",
|
||||
" 'name', entity_8.name,",
|
||||
" 'token', bot_6.token,",
|
||||
" 'type', entity_8.type",
|
||||
" )",
|
||||
" FROM agreego.bot bot_6",
|
||||
" JOIN agreego.organization organization_7 ON organization_7.id = bot_6.id",
|
||||
" JOIN agreego.entity entity_8 ON entity_8.id = organization_7.id",
|
||||
" WHERE",
|
||||
" NOT entity_8.archived))",
|
||||
" WHEN organization_1.type = 'organization' THEN",
|
||||
" ((SELECT jsonb_build_object(",
|
||||
" 'archived', entity_10.archived,",
|
||||
" 'created_at', entity_10.created_at,",
|
||||
" 'id', entity_10.id,",
|
||||
" 'name', entity_10.name,",
|
||||
" 'type', entity_10.type",
|
||||
" )",
|
||||
" FROM agreego.organization organization_9",
|
||||
" JOIN agreego.entity entity_10 ON entity_10.id = organization_9.id",
|
||||
" WHERE",
|
||||
" NOT entity_10.archived))",
|
||||
" ELSE NULL END",
|
||||
")",
|
||||
"FROM agreego.organization organization_1",
|
||||
"JOIN agreego.entity entity_2 ON entity_2.id = organization_1.id",
|
||||
"WHERE NOT entity_2.archived)"
|
||||
]
|
||||
]
|
||||
Reference in New Issue
Block a user