Compare commits
2 Commits
83efdf59d4
...
233829223e
| Author | SHA1 | Date |
|---|---|---|
|
|
233829223e | |
|
|
456b69f1ca |
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"name": "traxxx-web",
|
||||
"version": "0.41.21",
|
||||
"version": "0.41.22",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"version": "0.41.21",
|
||||
"version": "0.41.22",
|
||||
"dependencies": {
|
||||
"@brillout/json-serializer": "^0.5.8",
|
||||
"@dicebear/collection": "^7.0.5",
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@
|
|||
"overrides": {
|
||||
"vite": "$vite"
|
||||
},
|
||||
"version": "0.41.21",
|
||||
"version": "0.41.22",
|
||||
"imports": {
|
||||
"#/*": "./*.js"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,18 +97,18 @@ export async function fetchEntitiesById(entityIds, options = {}, reqUser) {
|
|||
.select(
|
||||
'entities.*',
|
||||
knex.raw('row_to_json(parents) as parent'),
|
||||
knex.raw('row_to_json(affiliates) as affiliate'),
|
||||
knex.raw('coalesce(row_to_json(affiliates), row_to_json(network_affiliates)) as affiliate'),
|
||||
)
|
||||
.whereIn('entities.id', entityIds)
|
||||
.leftJoin('entities as parents', 'parents.id', 'entities.parent_id')
|
||||
.leftJoin('affiliates', knex.raw('affiliates.entity_id in (entities.id, parents.id)'))
|
||||
.leftJoin('affiliates', 'affiliates.entity_id', 'entities.id')
|
||||
.leftJoin('affiliates as network_affiliates', 'network_affiliates.entity_id', 'parents.id')
|
||||
.modify((builder) => {
|
||||
if (options.order) {
|
||||
builder.orderBy(...options.order);
|
||||
}
|
||||
})
|
||||
.orderBy(knex.raw('case when affiliates.entity_id = entities.id then 1 else 2 end'))
|
||||
.groupBy('entities.id', 'parents.id', 'affiliates.id', 'affiliates.entity_id'),
|
||||
.groupBy('entities.id', 'parents.id', 'affiliates.id', 'affiliates.entity_id', 'network_affiliates.id', 'network_affiliates.entity_id'),
|
||||
options.includeChildren ? knex('entities')
|
||||
.whereIn('entities.parent_id', entityIds)
|
||||
.whereNot('type', 'info')
|
||||
|
|
|
|||
Loading…
Reference in New Issue