forked from DebaucheryLibrarian/traxxx
Returning existing release ID in case new scene for existing movie was encountered.
This commit is contained in:
parent
421e8d0763
commit
a4c82a377b
|
@ -509,6 +509,7 @@ async function linkMovieScenes(release, context) {
|
|||
|
||||
async function addRelease(release, context) {
|
||||
const existingRelease = await knex(`${release.type}s`)
|
||||
.select(`${release.type}s.*`, 'entities.name as entity_name')
|
||||
.leftJoin('entities', 'entities.id', `${release.type}s.entity_id`)
|
||||
.where('entry_id', release.entryId)
|
||||
.where('entities.slug', release.entity.slug)
|
||||
|
@ -517,7 +518,12 @@ async function addRelease(release, context) {
|
|||
|
||||
if (existingRelease) {
|
||||
console.log(`Skipping ${release.entity.slug} release "${release.title}", already in database`);
|
||||
return false;
|
||||
|
||||
return {
|
||||
...release,
|
||||
id: existingRelease.id,
|
||||
entityName: existingRelease.entity_name,
|
||||
};
|
||||
}
|
||||
|
||||
const [entity] = await Promise.all([
|
||||
|
@ -552,7 +558,6 @@ async function addRelease(release, context) {
|
|||
const releaseWithId = {
|
||||
...release,
|
||||
id: releaseEntry.id,
|
||||
entityId: entity.id,
|
||||
entityName: entity.name,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue