forked from DebaucheryLibrarian/traxxx
Refactored various modules for entities. Updated and refactored Kink scraper.
This commit is contained in:
@@ -100,6 +100,7 @@ function curateSite(site, network) {
|
||||
|
||||
function curateNetwork(network, releases) {
|
||||
const curatedNetwork = {
|
||||
...network,
|
||||
id: network.id,
|
||||
name: network.name,
|
||||
slug: network.slug,
|
||||
@@ -116,6 +117,19 @@ function curateNetwork(network, releases) {
|
||||
return curatedNetwork;
|
||||
}
|
||||
|
||||
function curateEntity(entity, parent, releases) {
|
||||
const curatedEntity = {
|
||||
...entity,
|
||||
children: [],
|
||||
};
|
||||
|
||||
if (entity.parent || parent) curatedEntity.parent = curateEntity(entity.parent || parent);
|
||||
if (entity.children) curatedEntity.children = entity.children.map(childEntity => curateEntity(childEntity, curatedEntity));
|
||||
if (releases) curatedEntity.releases = releases.map(release => curateRelease(release));
|
||||
|
||||
return curatedEntity;
|
||||
}
|
||||
|
||||
function curateTag(tag) {
|
||||
const curatedTag = {
|
||||
...tag,
|
||||
@@ -130,6 +144,7 @@ function curateTag(tag) {
|
||||
|
||||
export {
|
||||
curateActor,
|
||||
curateEntity,
|
||||
curateRelease,
|
||||
curateSite,
|
||||
curateNetwork,
|
||||
|
||||
Reference in New Issue
Block a user