diff --git a/src/backend/middlewares/user/AuthenticationMWs.ts b/src/backend/middlewares/user/AuthenticationMWs.ts index 6a3f6ea3..92e9567b 100644 --- a/src/backend/middlewares/user/AuthenticationMWs.ts +++ b/src/backend/middlewares/user/AuthenticationMWs.ts @@ -173,8 +173,7 @@ export class AuthenticationMWs { return next(); } catch (err) { - console.error(err); - return next(new ErrorDTO(ErrorCodes.CREDENTIAL_NOT_FOUND, 'credentials not found during login')); + return next(new ErrorDTO(ErrorCodes.CREDENTIAL_NOT_FOUND, 'credentials not found during login', err)); } diff --git a/src/backend/model/database/sql/IndexingManager.ts b/src/backend/model/database/sql/IndexingManager.ts index 1433f545..779e33af 100644 --- a/src/backend/model/database/sql/IndexingManager.ts +++ b/src/backend/model/database/sql/IndexingManager.ts @@ -41,7 +41,7 @@ export class IndexingManager implements IIndexingManager { if (ServerPG2ConfMap[f.name] === ServerSidePG2ConfAction.SAVED_SEARCH) { const fullMediaPath = path.join(ProjectPath.ImageFolder, f.directory.path, f.directory.name, f.name); - Logger.silly(LOG_TAG, 'Saving saved searches to DB from:', fullMediaPath); + Logger.silly(LOG_TAG, 'Saving saved-searches to DB from:', fullMediaPath); const savedSearches: { name: string, searchQuery: SearchQueryDTO }[] = JSON.parse(await fs.promises.readFile(fullMediaPath, 'utf8')); for (const s of savedSearches) { @@ -363,7 +363,7 @@ export class IndexingManager implements IIndexingManager { this.isSaving = true; try { const connection = await SQLConnection.getConnection(); - const serverSideConfigs = scannedDirectory.metaFile.filter(m => ServerPG2ConfMap[m.name]); + const serverSideConfigs = scannedDirectory.metaFile.filter(m => !!ServerPG2ConfMap[m.name]); scannedDirectory.metaFile = scannedDirectory.metaFile.filter(m => !ServerPG2ConfMap[m.name]); const currentDirId: number = await this.saveParentDir(connection, scannedDirectory); await this.saveChildDirs(connection, currentDirId, scannedDirectory); @@ -372,8 +372,6 @@ export class IndexingManager implements IIndexingManager { await ObjectManagers.getInstance().PersonManager.onGalleryIndexUpdate(); await ObjectManagers.getInstance().VersionManager.updateDataVersion(); await IndexingManager.processServerSidePG2Conf(serverSideConfigs); - } catch (e) { - throw e; } finally { this.isSaving = false; } diff --git a/src/common/PG2ConfMap.ts b/src/common/PG2ConfMap.ts index d8605988..d25ab0f0 100644 --- a/src/common/PG2ConfMap.ts +++ b/src/common/PG2ConfMap.ts @@ -22,6 +22,7 @@ export const PG2ConfMap = { export enum ServerSidePG2ConfAction { + // Enum always starts from 1 as !!0 === false SAVED_SEARCH = 1 } diff --git a/test/backend/unit/model/sql/IndexingManager.spec.ts b/test/backend/unit/model/sql/IndexingManager.spec.ts index a089f16d..806859b7 100644 --- a/test/backend/unit/model/sql/IndexingManager.spec.ts +++ b/test/backend/unit/model/sql/IndexingManager.spec.ts @@ -583,15 +583,18 @@ describe('IndexingManager', (sqlHelper: DBTestHelper) => { it('.saved_searches.pg2conf', async () => { Config.Server.Threading.enabled = false; + Config.Client.Album.enabled = true; Config.Server.Media.folder = path.join(__dirname, '/../../../assets'); ProjectPath.ImageFolder = path.join(__dirname, '/../../../assets'); const im = new IndexingManagerTest(); const am = new AlbumManager(); + const dir = await DiskManager.scanDirectory('/'); await im.saveToDB(dir); + const albums = await am.getAlbums(); - expect(albums[0].preview).to.be.an('object'); + // expect(albums[0].preview).to.be.an('object'); delete albums[0].preview; expect(albums).to.be.equalInAnyOrder([ {