Added actors page. Added site logos with overview on network page.
This commit is contained in:
40
src/actors.js
Normal file
40
src/actors.js
Normal file
@@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
|
||||
const knex = require('./knex');
|
||||
|
||||
async function curateActor(actor) {
|
||||
const aliases = await knex('actors')
|
||||
.where({ alias_for: actor.id });
|
||||
|
||||
return {
|
||||
id: actor.id,
|
||||
name: actor.name,
|
||||
description: actor.description,
|
||||
birthdate: actor.birthdate && new Date(actor.birthdate),
|
||||
country: actor.country_alpha2,
|
||||
city: actor.city,
|
||||
ethnicity: actor.ethnicity,
|
||||
height: actor.height,
|
||||
boobSize: actor.boobs_size,
|
||||
boobsNatural: actor.boobs_natural,
|
||||
aliases: aliases.map(({ name }) => name),
|
||||
slug: actor.slug,
|
||||
};
|
||||
}
|
||||
|
||||
function curateActors(releases) {
|
||||
return Promise.all(releases.map(async release => curateActor(release)));
|
||||
}
|
||||
|
||||
async function fetchActors(actorId, actorSlug) {
|
||||
const releases = await knex('actors')
|
||||
.where({ id: actorId })
|
||||
.orWhere({ slug: actorSlug })
|
||||
.limit(100);
|
||||
|
||||
return curateActors(releases);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
fetchActors,
|
||||
};
|
||||
Reference in New Issue
Block a user