Showing teaser of trailer is not available on scene page.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user