Skip to content

Commit 71196fc

Browse files
committed
fix: sql tools table fetch
1 parent 554b36b commit 71196fc

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

server/src/repositories/sync.repository.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ class AlbumToAssetSync extends BaseSync {
302302
}
303303

304304
cleanupAuditTable(daysAgo: number) {
305-
console.log('FUCK');
306305
return this.auditCleanup('album_asset_audit', daysAgo);
307306
}
308307

server/test/medium/specs/services/sync.service.spec.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { schemaFromCode } from '@immich/sql-tools';
12
import { Kysely } from 'kysely';
23
import { DateTime } from 'luxon';
34
import { AssetMetadataKey, UserMetadataKey } from 'src/enum';
@@ -6,7 +7,6 @@ import { LoggingRepository } from 'src/repositories/logging.repository';
67
import { BaseSync, SyncRepository } from 'src/repositories/sync.repository';
78
import { DB } from 'src/schema';
89
import { SyncService } from 'src/services/sync.service';
9-
import { getRegisteredItems } from 'src/sql-tools/register';
1010
import { newMediumService } from 'test/medium.factory';
1111
import { getKyselyDB } from 'test/utils';
1212
import { v4 } from 'uuid';
@@ -227,10 +227,9 @@ describe(SyncService.name, () => {
227227
it('should cleanup every table', async () => {
228228
const { sut } = setup();
229229

230-
const tables = getRegisteredItems().filter((t) => t.type === 'table');
231-
const auditTables = tables
232-
.filter((t) => t.item.options.name?.endsWith('_audit'))
233-
.map((t) => t.item.options.name!) as (keyof DB)[];
230+
const auditTables = schemaFromCode()
231+
.tables.filter((table) => table.name.endsWith('_audit'))
232+
.map(({ name }) => name);
234233

235234
const auditCleanupSpy = vi.spyOn(BaseSync.prototype as any, 'auditCleanup');
236235
await expect(sut.onAuditTableCleanup()).resolves.toBeUndefined();

0 commit comments

Comments
 (0)