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