Showing teaser of trailer is not available on scene page.

This commit is contained in:
2024-06-04 00:44:28 +02:00
parent 988ee9bdcf
commit 774f171c5c
4 changed files with 23 additions and 12 deletions

View File

@@ -25,28 +25,30 @@ export function curateEntity(entity, context) {
export async function fetchEntities(options) {
const entities = await knex('entities')
.select('entities.*', knex.raw('row_to_json(parents) as parent'))
.modify((builder) => {
if (options.query) {
builder.where((whereBuilder) => {
whereBuilder
.whereILike('name', `%${options.query}%`)
.orWhereILike('slug', `%${options.query}%`);
.whereILike('entities.name', `%${options.query}%`)
.orWhereILike('entities.slug', `%${options.query}%`);
});
}
if (options.type === 'primary') {
builder
.where('type', 'network')
.orWhere('independent', true)
.orWhereNull('parent_id');
.where('entities.type', 'network')
.orWhere('entities.independent', true)
.orWhereNull('entities.parent_id');
return;
}
if (options.type) {
builder.where('type', options.type);
builder.where('entities.type', options.type);
}
})
.leftJoin('entities as parents', 'parents.id', 'entities.parent_id')
.orderBy(...(options.order || ['name', 'asc']))
.limit(options.limit || 1000);