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

@@ -6,7 +6,10 @@ async function fetchActorsApi(req, res) {
const actorId = typeof req.params.actorId === 'number' ? req.params.actorId : null;
const actorSlug = typeof req.params.actorId === 'string' ? req.params.actorId : null;
const actors = await fetchActors(actorId, actorSlug);
const actors = await fetchActors({
id: actorId,
slug: actorSlug,
});
res.send(actors);
}

View File

@@ -3,10 +3,13 @@
const { fetchNetworks, fetchNetworksFromReleases } = require('../networks');
async function fetchNetworksApi(req, res) {
const networkId = typeof req.params.networkId === 'number' ? req.params.networkId : null;
const networkSlug = typeof req.params.networkId === 'string' ? req.params.networkId : null;
const networkId = typeof req.params.networkId === 'number' ? req.params.networkId : undefined; // null will literally include NULL results
const networkSlug = typeof req.params.networkId === 'string' ? req.params.networkId : undefined;
const networks = await fetchNetworks(networkId, networkSlug);
const networks = await fetchNetworks({
id: networkId,
slug: networkSlug,
});
res.send(networks);
}

View File

@@ -9,7 +9,7 @@ const {
} = require('../releases');
async function fetchReleasesApi(req, res) {
const releases = await fetchReleases(req.params.releaseId);
const releases = await fetchReleases(req.params.releaseId, req.query.filter ? [].concat(req.query.filter) : []);
res.send(releases);
}

View File

@@ -3,10 +3,13 @@
const { fetchTags } = require('../tags');
async function fetchTagsApi(req, res) {
const tagId = typeof req.params.tagId === 'number' ? req.params.tagId : null;
const tagSlug = typeof req.params.tagId === 'string' ? req.params.tagId : null;
const tagId = typeof req.params.tagId === 'number' ? req.params.tagId : undefined; // null will literally include NULL results
const tagSlug = typeof req.params.tagId === 'string' ? req.params.tagId : undefined;
const tags = await fetchTags(tagId, tagSlug);
const tags = await fetchTags({
id: tagId,
slug: tagSlug,
});
res.send(tags);
}