forked from DebaucheryLibrarian/traxxx
Added tag reassociation and dedupe migration.
This commit is contained in:
@@ -368,9 +368,7 @@ async function searchEntities(query, type, limit) {
|
||||
return curateEntities(entities);
|
||||
}
|
||||
|
||||
async function flushEntities(networkSlugs = [], channelSlugs = []) {
|
||||
const entitySlugs = networkSlugs.concat(channelSlugs).join(', ');
|
||||
|
||||
async function fetchEntityReleaseIds(networkSlugs = [], channelSlugs = []) {
|
||||
const entityQuery = knex
|
||||
.withRecursive('selected_entities', knex.raw(`
|
||||
SELECT entities.*
|
||||
@@ -443,6 +441,17 @@ async function flushEntities(networkSlugs = [], channelSlugs = []) {
|
||||
})
|
||||
.pluck('series.id');
|
||||
|
||||
return {
|
||||
sceneIds,
|
||||
movieIds,
|
||||
serieIds,
|
||||
};
|
||||
}
|
||||
|
||||
async function flushEntities(networkSlugs = [], channelSlugs = []) {
|
||||
const { sceneIds, movieIds, serieIds } = await fetchEntityReleaseIds(networkSlugs, channelSlugs);
|
||||
const entitySlugs = networkSlugs.concat(channelSlugs).join(', ');
|
||||
|
||||
if (sceneIds.length === 0 && movieIds.length === 0 && serieIds.length === 0) {
|
||||
logger.info(`No scenes, movies or series found to remove for ${entitySlugs}`);
|
||||
return;
|
||||
@@ -479,6 +488,7 @@ module.exports = {
|
||||
fetchIncludedEntities,
|
||||
fetchReleaseEntities,
|
||||
fetchEntitiesBySlug,
|
||||
fetchEntityReleaseIds,
|
||||
fetchEntity,
|
||||
fetchEntities,
|
||||
getRecursiveParent,
|
||||
|
||||
Reference in New Issue
Block a user