Refactoring client to reflect database changes.
This commit is contained in:
@@ -399,7 +399,7 @@ async function scrapeBasicActors() {
|
||||
async function associateActors(mappedActors, releases) {
|
||||
const [existingActorEntries, existingAssociationEntries] = await Promise.all([
|
||||
knex('actors').whereIn('name', Object.keys(mappedActors)),
|
||||
knex('actors_associated').whereIn('release_id', releases.map(release => release.id)),
|
||||
knex('releases_actors').whereIn('release_id', releases.map(release => release.id)),
|
||||
]);
|
||||
|
||||
const associations = await Promise.map(Object.entries(mappedActors), async ([actorName, releaseIds]) => {
|
||||
@@ -418,7 +418,7 @@ async function associateActors(mappedActors, releases) {
|
||||
});
|
||||
|
||||
await Promise.all([
|
||||
knex('actors_associated').insert(associations.flat()),
|
||||
knex('releases_actors').insert(associations.flat()),
|
||||
scrapeBasicActors(),
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user