Added tag filter to releases query, enabled on homepage.

This commit is contained in:
2019-11-13 03:14:24 +01:00
parent d1212725bb
commit f9f9cc7977
26 changed files with 555 additions and 192 deletions

View File

@@ -1,6 +1,7 @@
'use strict';
const knex = require('./knex');
const whereOr = require('./utils/where-or');
async function curateActor(actor) {
const aliases = await knex('actors')
@@ -26,10 +27,9 @@ function curateActors(releases) {
return Promise.all(releases.map(async release => curateActor(release)));
}
async function fetchActors(actorId, actorSlug) {
async function fetchActors(queryObject) {
const releases = await knex('actors')
.where({ id: actorId })
.orWhere({ slug: actorSlug })
.where(builder => whereOr(queryObject, 'actors', builder))
.limit(100);
return curateActors(releases);