Fixed existing stash selection in transfer tool.

This commit is contained in:
DebaucheryLibrarian 2023-06-08 01:37:27 +02:00
parent aa0fd3cf48
commit 5576fed590
2 changed files with 8 additions and 7 deletions

View File

@ -7,9 +7,12 @@ async function getStashId(stash, user) {
.select('id') .select('id')
.where('user_id', user.id) .where('user_id', user.id)
.where((builder) => { .where((builder) => {
builder if (stash.primary) {
.where('slug', stash.slug) builder.where('primary', true);
.orWhere('primary', stash.primary); return;
}
builder.where('slug', stash.slug);
}) })
.first(); .first();

View File

@ -38,10 +38,6 @@ async function save() {
.leftJoin('entities', 'entities.id', 'actors.entity_id') .leftJoin('entities', 'entities.id', 'actors.entity_id')
.where('stashes_actors.stash_id', stash.id); .where('stashes_actors.stash_id', stash.id);
console.log('scenes', scenes);
console.log('movies', movies);
console.log('actors', actors);
const curatedStash = JSON.stringify({ const curatedStash = JSON.stringify({
username: stash.username, username: stash.username,
name: stash.name, name: stash.name,
@ -73,6 +69,8 @@ async function save() {
await fs.promises.appendFile(filename, `${curatedStash}\n`); await fs.promises.appendFile(filename, `${curatedStash}\n`);
console.log(`Saved ${stash.username} stash ${stash.name}`);
savedStashes += 1; savedStashes += 1;
}, Promise.resolve([])); }, Promise.resolve([]));