2024-03-15 23:01:58 +01:00
|
|
|
import { join } from 'node:path';
|
2024-03-21 04:15:09 +01:00
|
|
|
import { APP_MEDIA_LOCATION } from 'src/constants';
|
2024-03-20 21:20:38 +01:00
|
|
|
import { THUMBNAIL_DIR } from 'src/cores/storage.core';
|
2024-05-21 00:09:10 +02:00
|
|
|
import { LibraryEntity } from 'src/entities/library.entity';
|
2024-03-20 19:32:04 +01:00
|
|
|
import { userStub } from 'test/fixtures/user.stub';
|
2023-09-20 13:16:33 +02:00
|
|
|
|
|
|
|
export const libraryStub = {
|
|
|
|
externalLibrary1: Object.freeze<LibraryEntity>({
|
|
|
|
id: 'library-id',
|
|
|
|
name: 'test_library',
|
|
|
|
assets: [],
|
2024-02-29 19:35:37 +01:00
|
|
|
owner: userStub.admin,
|
|
|
|
ownerId: 'admin_id',
|
2023-09-20 13:16:33 +02:00
|
|
|
importPaths: [],
|
|
|
|
createdAt: new Date('2023-01-01'),
|
|
|
|
updatedAt: new Date('2023-01-01'),
|
|
|
|
refreshedAt: null,
|
|
|
|
exclusionPatterns: [],
|
|
|
|
}),
|
2024-01-31 09:15:54 +01:00
|
|
|
externalLibrary2: Object.freeze<LibraryEntity>({
|
|
|
|
id: 'library-id2',
|
|
|
|
name: 'test_library2',
|
|
|
|
assets: [],
|
2024-02-29 19:35:37 +01:00
|
|
|
owner: userStub.admin,
|
|
|
|
ownerId: 'admin_id',
|
2024-01-31 09:15:54 +01:00
|
|
|
importPaths: [],
|
|
|
|
createdAt: new Date('2021-01-01'),
|
|
|
|
updatedAt: new Date('2022-01-01'),
|
|
|
|
refreshedAt: null,
|
|
|
|
exclusionPatterns: [],
|
|
|
|
}),
|
|
|
|
externalLibraryWithImportPaths1: Object.freeze<LibraryEntity>({
|
|
|
|
id: 'library-id-with-paths1',
|
|
|
|
name: 'library-with-import-paths1',
|
|
|
|
assets: [],
|
2024-02-29 19:35:37 +01:00
|
|
|
owner: userStub.admin,
|
|
|
|
ownerId: 'admin_id',
|
2024-01-31 09:15:54 +01:00
|
|
|
importPaths: ['/foo', '/bar'],
|
|
|
|
createdAt: new Date('2023-01-01'),
|
|
|
|
updatedAt: new Date('2023-01-01'),
|
|
|
|
refreshedAt: null,
|
|
|
|
exclusionPatterns: [],
|
|
|
|
}),
|
|
|
|
externalLibraryWithImportPaths2: Object.freeze<LibraryEntity>({
|
|
|
|
id: 'library-id-with-paths2',
|
|
|
|
name: 'library-with-import-paths2',
|
|
|
|
assets: [],
|
2024-02-29 19:35:37 +01:00
|
|
|
owner: userStub.admin,
|
|
|
|
ownerId: 'admin_id',
|
2024-01-31 09:15:54 +01:00
|
|
|
importPaths: ['/xyz', '/asdf'],
|
|
|
|
createdAt: new Date('2023-01-01'),
|
|
|
|
updatedAt: new Date('2023-01-01'),
|
|
|
|
refreshedAt: null,
|
|
|
|
exclusionPatterns: [],
|
|
|
|
}),
|
|
|
|
externalLibraryWithExclusionPattern: Object.freeze<LibraryEntity>({
|
|
|
|
id: 'library-id',
|
|
|
|
name: 'test_library',
|
|
|
|
assets: [],
|
2024-02-29 19:35:37 +01:00
|
|
|
owner: userStub.admin,
|
2024-01-31 09:15:54 +01:00
|
|
|
ownerId: 'user-id',
|
|
|
|
importPaths: [],
|
|
|
|
createdAt: new Date('2023-01-01'),
|
|
|
|
updatedAt: new Date('2023-01-01'),
|
|
|
|
refreshedAt: null,
|
|
|
|
exclusionPatterns: ['**/dir1/**'],
|
|
|
|
}),
|
|
|
|
patternPath: Object.freeze<LibraryEntity>({
|
|
|
|
id: 'library-id1337',
|
|
|
|
name: 'importpath-exclusion-library1',
|
|
|
|
assets: [],
|
2024-02-29 19:35:37 +01:00
|
|
|
owner: userStub.admin,
|
2024-01-31 09:15:54 +01:00
|
|
|
ownerId: 'user-id',
|
|
|
|
importPaths: ['/xyz', '/asdf'],
|
|
|
|
createdAt: new Date('2023-01-01'),
|
|
|
|
updatedAt: new Date('2023-01-01'),
|
|
|
|
refreshedAt: null,
|
|
|
|
exclusionPatterns: ['**/dir1/**'],
|
|
|
|
}),
|
2024-03-15 23:01:58 +01:00
|
|
|
hasImmichPaths: Object.freeze<LibraryEntity>({
|
|
|
|
id: 'library-id1337',
|
|
|
|
name: 'importpath-exclusion-library1',
|
|
|
|
assets: [],
|
|
|
|
owner: userStub.admin,
|
|
|
|
ownerId: 'user-id',
|
|
|
|
importPaths: [join(THUMBNAIL_DIR, 'library'), '/xyz', join(APP_MEDIA_LOCATION, 'library')],
|
|
|
|
createdAt: new Date('2023-01-01'),
|
|
|
|
updatedAt: new Date('2023-01-01'),
|
|
|
|
refreshedAt: null,
|
|
|
|
exclusionPatterns: ['**/dir1/**'],
|
|
|
|
}),
|
2023-09-20 13:16:33 +02:00
|
|
|
};
|