1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-11-27 22:38:10 +02:00

Adding count and precalculated preview to saved search #45

This commit is contained in:
Patrik J. Braun
2021-05-31 19:55:27 +02:00
parent 2e12af46d1
commit 597d179f7d
12 changed files with 70 additions and 21 deletions

View File

@@ -14,11 +14,11 @@ import {ObjectManagers} from '../../../../../src/backend/model/ObjectManagers';
import {DBTestHelper} from '../../../DBTestHelper';
import {DiskMangerWorker} from '../../../../../src/backend/model/threading/DiskMangerWorker';
import {ReIndexingSensitivity} from '../../../../../src/common/config/private/PrivateConfig';
import {AlbumManager} from '../../../../../src/backend/model/database/sql/AlbumManager';
import {SearchQueryTypes, TextSearch, TextSearchQueryMatchTypes} from '../../../../../src/common/entities/SearchQueryDTO';
import {ProjectPath} from '../../../../../src/backend/ProjectPath';
import * as path from 'path';
import {DiskManager} from '../../../../../src/backend/model/DiskManger';
import {AlbumManager} from '../../../../../src/backend/model/database/sql/AlbumManager';
const deepEqualInAnyOrder = require('deep-equal-in-any-order');
const chai = require('chai');
@@ -47,7 +47,7 @@ class IndexingManagerTest extends IndexingManager {
}
public async saveToDB(scannedDirectory: DirectoryDTO): Promise<void> {
return super.saveToDB(scannedDirectory);
return await super.saveToDB(scannedDirectory);
}
}
@@ -591,16 +591,18 @@ describe('IndexingManager', (sqlHelper: DBTestHelper) => {
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([
{
id: 1,
name: 'Alvin',
locked: true,
count: 1,
searchQuery: {
type: SearchQueryTypes.person,
text: 'Alvin',