Further refactoring. Fixed actor pages and more.
This commit is contained in:
@@ -17,8 +17,8 @@ async function curateActor(actor) {
|
||||
knex('media')
|
||||
.where({ domain: 'actors', target_id: actor.id })
|
||||
.orderBy('index'),
|
||||
knex('social')
|
||||
.where({ domain: 'actors', target_id: actor.id })
|
||||
knex('actors_social')
|
||||
.where('actor_id', actor.id)
|
||||
.orderBy('platform', 'desc'),
|
||||
]);
|
||||
|
||||
@@ -197,8 +197,7 @@ function curateSocialEntry(url, actorId) {
|
||||
return {
|
||||
url: match.url,
|
||||
platform: match.platform,
|
||||
domain: 'actors',
|
||||
target_id: actorId,
|
||||
actor_id: actorId,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -207,10 +206,7 @@ async function curateSocialEntries(urls, actorId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const existingSocialLinks = await knex('social').where({
|
||||
domain: 'actors',
|
||||
target_id: actorId,
|
||||
});
|
||||
const existingSocialLinks = await knex('actors_social').where('actor_id', actorId);
|
||||
|
||||
return urls.reduce((acc, url) => {
|
||||
const socialEntry = curateSocialEntry(url, actorId);
|
||||
@@ -243,7 +239,7 @@ async function fetchActors(queryObject, limit = 100) {
|
||||
async function storeSocialLinks(urls, actorId) {
|
||||
const curatedSocialEntries = await curateSocialEntries(urls, actorId);
|
||||
|
||||
await knex('social').insert(curatedSocialEntries);
|
||||
await knex('actors_social').insert(curatedSocialEntries);
|
||||
}
|
||||
|
||||
async function storeActor(actor, scraped = false, scrapeSuccess = false) {
|
||||
@@ -358,7 +354,7 @@ async function scrapeActors(actorNames) {
|
||||
updateActor(profile, true, true),
|
||||
// storeAvatars(profile, actorEntry),
|
||||
storePhotos(profile.avatars, {
|
||||
domain: 'actors',
|
||||
domain: 'actor',
|
||||
role: 'photo',
|
||||
primaryRole: 'avatar',
|
||||
targetId: actorEntry.id,
|
||||
|
||||
Reference in New Issue
Block a user