Skip to content

Commit

Permalink
Add extra filter by scope for optimize performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey-weber committed Nov 29, 2024
1 parent 030b6aa commit 267a68c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/services/entry/actions/get-related-entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,13 @@ export async function getRelatedEntries(
endToStart ? 'l.fromId' : 'l.toId',
)
.join('entries', 'entries.entryId', endToStart ? 'l.toId' : 'l.fromId')
.where('isDeleted', false)
.where('depth', '<', 5);
.where((builder) => {
builder.where({isDeleted: false});
builder.andWhere('depth', '<', 5);
if (scope) {
builder.andWhere('entries.scope', scope);
}
});
});
})
.select()
Expand Down

0 comments on commit 267a68c

Please sign in to comment.