Skip to content

High performance self-hosted photo and video management solution.

chore(server): remove unused code (#13367)

Jason Rasmussen930df46f74c0
diff --git a/server/src/cores/storage.core.ts b/server/src/cores/storage.core.ts
index 8e42cd1076..c49175172d 100644
--- a/server/src/cores/storage.core.ts
+++ b/server/src/cores/storage.core.ts
@@ -15,9 +15,6 @@ import { ISystemMetadataRepository } from 'src/interfaces/system-metadata.interf
import { getAssetFiles } from 'src/utils/asset.util';
import { getConfig } from 'src/utils/config';
-export const THUMBNAIL_DIR = resolve(join(APP_MEDIA_LOCATION, StorageFolder.THUMBNAILS));
-export const ENCODED_VIDEO_DIR = resolve(join(APP_MEDIA_LOCATION, StorageFolder.ENCODED_VIDEO));
-
export interface MoveRequest {
entityId: string;
pathType: PathType;
@@ -118,10 +115,6 @@ export class StorageCore {
return normalizedPath.startsWith(normalizedAppMediaLocation);
}
- static isGeneratedAsset(path: string) {
- return path.startsWith(THUMBNAIL_DIR) || path.startsWith(ENCODED_VIDEO_DIR);
- }
-
async moveAssetImage(asset: AssetEntity, pathType: GeneratedImageType, format: ImageFormat) {
const { id: entityId, files } = asset;
const { thumbnailFile, previewFile } = getAssetFiles(files);
diff --git a/server/src/interfaces/asset.interface.ts b/server/src/interfaces/asset.interface.ts
index 750a852094..37d3326a8a 100644
--- a/server/src/interfaces/asset.interface.ts
+++ b/server/src/interfaces/asset.interface.ts
@@ -172,12 +172,6 @@ export interface IAssetRepository {
order?: FindOptionsOrder<AssetEntity>,
): Promise<AssetEntity | null>;
getWithout(pagination: PaginationOptions, property: WithoutProperty): Paginated<AssetEntity>;
- getWith(
- pagination: PaginationOptions,
- property: WithProperty,
- libraryId?: string,
- withDeleted?: boolean,
- ): Paginated<AssetEntity>;
getRandom(userIds: string[], count: number): Promise<AssetEntity[]>;
getLastUpdatedAssetForAlbumId(albumId: string): Promise<AssetEntity | null>;
getByLibraryIdAndOriginalPath(libraryId: string, originalPath: string): Promise<AssetEntity | null>;
diff --git a/server/src/interfaces/database.interface.ts b/server/src/interfaces/database.interface.ts
index e388f354f2..79550d416e 100644
--- a/server/src/interfaces/database.interface.ts
+++ b/server/src/interfaces/database.interface.ts
@@ -48,7 +48,6 @@ export interface IDatabaseRepository {
getPostgresVersion(): Promise<string>;
getPostgresVersionRange(): string;
createExtension(extension: DatabaseExtension): Promise<void>;
- updateExtension(extension: DatabaseExtension, version?: string): Promise<void>;
updateVectorExtension(extension: VectorExtension, version?: string): Promise<VectorUpdateResult>;
reindex(index: VectorIndex): Promise<void>;
shouldReindex(name: VectorIndex): Promise<boolean>;
diff --git a/server/src/interfaces/map.interface.ts b/server/src/interfaces/map.interface.ts
index 80b37c3a5f..0a04840a96 100644
--- a/server/src/interfaces/map.interface.ts
+++ b/server/src/interfaces/map.interface.ts
@@ -28,5 +28,4 @@ export interface IMapRepository {
init(): Promise<void>;
reverseGeocode(point: GeoPoint): Promise<ReverseGeocodeResult>;
getMapMarkers(ownerIds: string[], albumIds: string[], options?: MapMarkerSearchOptions): Promise<MapMarker[]>;
- fetchStyle(url: string): Promise<any>;
}
diff --git a/server/src/interfaces/person.interface.ts b/server/src/interfaces/person.interface.ts
index 57e46a439b..b3e2c0990e 100644
--- a/server/src/interfaces/person.interface.ts
+++ b/server/src/interfaces/person.interface.ts
@@ -57,9 +57,7 @@ export interface IPersonRepository {
create(person: Partial<PersonEntity>): Promise<PersonEntity>;
createAll(people: Partial<PersonEntity>[]): Promise<string[]>;
- createFaces(entities: Partial<AssetFaceEntity>[]): Promise<string[]>;
delete(entities: PersonEntity[]): Promise<void>;
- deleteAll(): Promise<void>;
deleteFaces(options: DeleteFacesOptions): Promise<void>;
refreshFaces(
facesToAdd: Partial<AssetFaceEntity>[],
diff --git a/server/src/repositories/asset.repository.ts b/server/src/repositories/asset.repository.ts
index 8bca755c32..fd47a976a5 100644
--- a/server/src/repositories/asset.repository.ts
+++ b/server/src/repositories/asset.repository.ts
@@ -499,39 +499,6 @@ export class AssetRepository implements IAssetRepository {
});
}
- getWith(
- pagination: PaginationOptions,
- property: WithProperty,
- libraryId?: string,
- withDeleted = false,
- ): Paginated<AssetEntity> {
- let where: FindOptionsWhere<AssetEntity> | FindOptionsWhere<AssetEntity>[] = {};
-
- switch (property) {
- case WithProperty.SIDECAR: {
- where = [{ sidecarPath: Not(IsNull()), isVisible: true }];
- break;
- }
-
- default: {
- throw new Error(`Invalid getWith property: ${property}`);
- }
- }
-
- if (libraryId) {
- where = [{ ...where, libraryId }];
- }
-
- return paginate(this.repository, pagination, {
- where,
- withDeleted,
- order: {
- // Ensures correct order when paginating
- createdAt: 'ASC',
- },
- });
- }
-
getLastUpdatedAssetForAlbumId(albumId: string): Promise<AssetEntity | null> {
return this.repository.findOne({
where: { albums: { id: albumId } },
diff --git a/server/src/repositories/database.repository.ts b/server/src/repositories/database.repository.ts
index 76998b5239..547f03fc20 100644
--- a/server/src/repositories/database.repository.ts
+++ b/server/src/repositories/database.repository.ts
@@ -74,10 +74,6 @@ export class DatabaseRepository implements IDatabaseRepository {
await this.dataSource.query(`CREATE EXTENSION IF NOT EXISTS ${extension}`);
}
- async updateExtension(extension: DatabaseExtension, version?: string): Promise<void> {
- await this.dataSource.query(`ALTER EXTENSION ${extension} UPDATE${version ? ` TO '${version}'` : ''}`);
- }
-
async updateVectorExtension(extension: VectorExtension, targetVersion?: string): Promise<VectorUpdateResult> {
const { availableVersion, installedVersion } = await this.getExtensionVersion(extension);
if (!installedVersion) {
diff --git a/server/src/repositories/map.repository.ts b/server/src/repositories/map.repository.ts
index 8ba9b4cab8..3e5c499f41 100644
--- a/server/src/repositories/map.repository.ts
+++ b/server/src/repositories/map.repository.ts
@@ -113,20 +113,6 @@ export class MapRepository implements IMapRepository {
}));
}
- async fetchStyle(url: string) {
- try {
- const response = await fetch(url);
-
- if (!response.ok) {
- throw new Error(`Failed to fetch data from ${url} with status ${response.status}: ${await response.text()}`);
- }
-
- return response.json();
- } catch (error) {
- throw new Error(`Failed to fetch data from ${url}: ${error}`);
- }
- }
-
async reverseGeocode(point: GeoPoint): Promise<ReverseGeocodeResult> {
this.logger.debug(`Request: ${point.latitude},${point.longitude}`);
diff --git a/server/src/repositories/person.repository.ts b/server/src/repositories/person.repository.ts
index 3ba9e23887..c62c4b8739 100644
--- a/server/src/repositories/person.repository.ts
+++ b/server/src/repositories/person.repository.ts
@@ -63,10 +63,6 @@ export class PersonRepository implements IPersonRepository {
await this.personRepository.remove(entities);
}
- async deleteAll(): Promise<void> {
- await this.personRepository.clear();
- }
-
async deleteFaces({ sourceType }: DeleteFacesOptions): Promise<void> {
await this.assetFaceRepository
.createQueryBuilder('asset_faces')
@@ -269,11 +265,6 @@ export class PersonRepository implements IPersonRepository {
return results.map((person) => person.id);
}
- async createFaces(entities: AssetFaceEntity[]): Promise<string[]> {
- const res = await this.assetFaceRepository.save(entities);
- return res.map((row) => row.id);
- }
-
async refreshFaces(
facesToAdd: Partial<AssetFaceEntity>[],
faceIdsToRemove: string[],
diff --git a/server/src/services/auth.service.spec.ts b/server/src/services/auth.service.spec.ts
index f45affe042..3701d3de56 100644
--- a/server/src/services/auth.service.spec.ts
+++ b/server/src/services/auth.service.spec.ts
@@ -13,7 +13,7 @@ import { ISystemMetadataRepository } from 'src/interfaces/system-metadata.interf
import { IUserRepository } from 'src/interfaces/user.interface';
import { AuthService } from 'src/services/auth.service';
import { keyStub } from 'test/fixtures/api-key.stub';
-import { authStub, loginResponseStub } from 'test/fixtures/auth.stub';
+import { authStub } from 'test/fixtures/auth.stub';
import { sessionStub } from 'test/fixtures/session.stub';
import { sharedLinkStub } from 'test/fixtures/shared-link.stub';
import { systemConfigStub } from 'test/fixtures/system-config.stub';
@@ -21,6 +21,16 @@ import { userStub } from 'test/fixtures/user.stub';
import { newTestService } from 'test/utils';
import { Mocked } from 'vitest';
+const oauthResponse = {
+ accessToken: 'cmFuZG9tLWJ5dGVz',
+ userId: 'user-id',
+ userEmail: '[email protected]',
+ name: 'immich_name',
+ profileImagePath: '',
+ isAdmin: false,
+ shouldChangePassword: false,
+};
+
// const token = Buffer.from('my-api-key', 'utf8').toString('base64');
const email = '[email protected]';
@@ -100,7 +110,15 @@ describe('AuthService', () => {
it('should successfully log the user in', async () => {
userMock.getByEmail.mockResolvedValue(userStub.user1);
sessionMock.create.mockResolvedValue(sessionStub.valid);
- await expect(sut.login(fixtures.login, loginDetails)).resolves.toEqual(loginResponseStub.user1password);
+ await expect(sut.login(fixtures.login, loginDetails)).resolves.toEqual({
+ accessToken: 'cmFuZG9tLWJ5dGVz',
+ userId: 'user-id',
+ userEmail: '[email protected]',
+ name: 'immich_name',
+ profileImagePath: '',
+ isAdmin: false,
+ shouldChangePassword: false,
+ });
expect(userMock.getByEmail).toHaveBeenCalledTimes(1);
});
});
@@ -469,7 +487,7 @@ describe('AuthService', () => {
sessionMock.create.mockResolvedValue(sessionStub.valid);
await expect(sut.callback({ url: 'http://immich/auth/login?code=abc123' }, loginDetails)).resolves.toEqual(
- loginResponseStub.user1oauth,
+ oauthResponse,
);
expect(userMock.getByEmail).toHaveBeenCalledTimes(1);
@@ -498,7 +516,7 @@ describe('AuthService', () => {
sessionMock.create.mockResolvedValue(sessionStub.valid);
await expect(sut.callback({ url: 'http://immich/auth/login?code=abc123' }, loginDetails)).resolves.toEqual(
- loginResponseStub.user1oauth,
+ oauthResponse,
);
expect(userMock.getByEmail).toHaveBeenCalledTimes(2); // second call is for domain check before create
@@ -546,7 +564,7 @@ describe('AuthService', () => {
userMock.create.mockResolvedValue(userStub.user1);
await expect(sut.callback({ url: 'http://immich/auth/login?code=abc123' }, loginDetails)).resolves.toEqual(
- loginResponseStub.user1oauth,
+ oauthResponse,
);
expect(userMock.create).toHaveBeenCalledWith(oauthUserWithDefaultQuota);
@@ -560,7 +578,7 @@ describe('AuthService', () => {
oauthMock.getProfile.mockResolvedValue({ sub, email, immich_quota: 'abc' });
await expect(sut.callback({ url: 'http://immich/auth/login?code=abc123' }, loginDetails)).resolves.toEqual(
- loginResponseStub.user1oauth,
+ oauthResponse,
);
expect(userMock.create).toHaveBeenCalledWith(oauthUserWithDefaultQuota);
@@ -574,7 +592,7 @@ describe('AuthService', () => {
oauthMock.getProfile.mockResolvedValue({ sub, email, immich_quota: -5 });
await expect(sut.callback({ url: 'http://immich/auth/login?code=abc123' }, loginDetails)).resolves.toEqual(
- loginResponseStub.user1oauth,
+ oauthResponse,
);
expect(userMock.create).toHaveBeenCalledWith(oauthUserWithDefaultQuota);
@@ -588,7 +606,7 @@ describe('AuthService', () => {
oauthMock.getProfile.mockResolvedValue({ sub, email, immich_quota: 0 });
await expect(sut.callback({ url: 'http://immich/auth/login?code=abc123' }, loginDetails)).resolves.toEqual(
- loginResponseStub.user1oauth,
+ oauthResponse,
);
expect(userMock.create).toHaveBeenCalledWith({
@@ -608,7 +626,7 @@ describe('AuthService', () => {
oauthMock.getProfile.mockResolvedValue({ sub, email, immich_quota: 5 });
await expect(sut.callback({ url: 'http://immich/auth/login?code=abc123' }, loginDetails)).resolves.toEqual(
- loginResponseStub.user1oauth,
+ oauthResponse,
);
expect(userMock.create).toHaveBeenCalledWith({
diff --git a/server/src/services/library.service.spec.ts b/server/src/services/library.service.spec.ts
index e8e276a0e2..7993c7dacc 100644
--- a/server/src/services/library.service.spec.ts
+++ b/server/src/services/library.service.spec.ts
@@ -141,8 +141,6 @@ describe(LibraryService.name, () => {
describe('handleQueueAssetRefresh', () => {
it('should queue refresh of a new asset', async () => {
- assetMock.getWith.mockResolvedValue({ items: [], hasNextPage: false });
-
libraryMock.get.mockResolvedValue(libraryStub.externalLibrary1);
storageMock.walk.mockImplementation(mockWalk);
@@ -179,8 +177,6 @@ describe(LibraryService.name, () => {
storageMock.checkFileExists.mockResolvedValue(true);
- assetMock.getWith.mockResolvedValue({ items: [], hasNextPage: false });
-
libraryMock.get.mockResolvedValue(libraryStub.externalLibraryWithImportPaths1);
await sut.handleQueueSyncFiles({ id: libraryStub.externalLibraryWithImportPaths1.id });
diff --git a/server/src/services/person.service.spec.ts b/server/src/services/person.service.spec.ts
index d3d0b457c7..da4656be02 100644
--- a/server/src/services/person.service.spec.ts
+++ b/server/src/services/person.service.spec.ts
@@ -721,7 +721,6 @@ describe(PersonService.name, () => {
'/uploads/user-id/thumbs/path.jpg',
expect.objectContaining({ minScore: 0.7, modelName: 'buffalo_l' }),
);
- expect(personMock.createFaces).not.toHaveBeenCalled();
expect(jobMock.queue).not.toHaveBeenCalled();
expect(jobMock.queueAll).not.toHaveBeenCalled();
@@ -733,7 +732,6 @@ describe(PersonService.name, () => {
});
it('should create a face with no person and queue recognition job', async () => {
- personMock.createFaces.mockResolvedValue([faceStub.face1.id]);
machineLearningMock.detectFaces.mockResolvedValue(detectFaceMock);
assetMock.getByIds.mockResolvedValue([assetStub.image]);
@@ -761,7 +759,6 @@ describe(PersonService.name, () => {
});
it('should add new face and delete an existing face not among the new detected faces', async () => {
- personMock.createFaces.mockResolvedValue([faceStub.face1.id]);
machineLearningMock.detectFaces.mockResolvedValue(detectFaceMock);
assetMock.getByIds.mockResolvedValue([{ ...assetStub.image, faces: [faceStub.primaryFace1] }]);
@@ -816,7 +813,6 @@ describe(PersonService.name, () => {
expect(personMock.reassignFaces).not.toHaveBeenCalled();
expect(personMock.create).not.toHaveBeenCalled();
- expect(personMock.createFaces).not.toHaveBeenCalled();
});
it('should fail if face does not have asset', async () => {
@@ -827,7 +823,6 @@ describe(PersonService.name, () => {
expect(personMock.reassignFaces).not.toHaveBeenCalled();
expect(personMock.create).not.toHaveBeenCalled();
- expect(personMock.createFaces).not.toHaveBeenCalled();
});
it('should skip if face already has an assigned person', async () => {
@@ -837,7 +832,6 @@ describe(PersonService.name, () => {
expect(personMock.reassignFaces).not.toHaveBeenCalled();
expect(personMock.create).not.toHaveBeenCalled();
- expect(personMock.createFaces).not.toHaveBeenCalled();
});
it('should match existing person', async () => {
diff --git a/server/test/fixtures/album.stub.ts b/server/test/fixtures/album.stub.ts
index c2c59a8007..3d2899d3c6 100644
--- a/server/test/fixtures/album.stub.ts
+++ b/server/test/fixtures/album.stub.ts
@@ -155,55 +155,4 @@ export const albumStub = {
isActivityEnabled: true,
order: AssetOrder.DESC,
}),
- emptyWithInvalidThumbnail: Object.freeze<AlbumEntity>({
- id: 'album-5',
- albumName: 'Empty album with invalid thumbnail',
- description: '',
- ownerId: authStub.admin.user.id,
- owner: userStub.admin,
- assets: [],
- albumThumbnailAsset: null,
- albumThumbnailAssetId: null,
- createdAt: new Date(),
- updatedAt: new Date(),
- deletedAt: null,
- sharedLinks: [],
- albumUsers: [],
- isActivityEnabled: true,
- order: AssetOrder.DESC,
- }),
- oneAssetInvalidThumbnail: Object.freeze<AlbumEntity>({
- id: 'album-6',
- albumName: 'Album with one asset and invalid thumbnail',
- description: '',
- ownerId: authStub.admin.user.id,
- owner: userStub.admin,
- assets: [assetStub.image],
- albumThumbnailAsset: assetStub.livePhotoMotionAsset,
- albumThumbnailAssetId: assetStub.livePhotoMotionAsset.id,
- createdAt: new Date(),
- updatedAt: new Date(),
- deletedAt: null,
- sharedLinks: [],
- albumUsers: [],
- isActivityEnabled: true,
- order: AssetOrder.DESC,
- }),
- oneAssetValidThumbnail: Object.freeze<AlbumEntity>({
- id: 'album-6',
- albumName: 'Album with one asset and invalid thumbnail',
- description: '',
- ownerId: authStub.admin.user.id,
- owner: userStub.admin,
- assets: [assetStub.image],
- albumThumbnailAsset: assetStub.image,
- albumThumbnailAssetId: assetStub.image.id,
- createdAt: new Date(),
- updatedAt: new Date(),
- deletedAt: null,
- sharedLinks: [],
- albumUsers: [],
- isActivityEnabled: true,
- order: AssetOrder.DESC,
- }),
};
diff --git a/server/test/fixtures/api-key.stub.ts b/server/test/fixtures/api-key.stub.ts
index 954c8f35a0..f8b1832c84 100644
--- a/server/test/fixtures/api-key.stub.ts
+++ b/server/test/fixtures/api-key.stub.ts
@@ -11,7 +11,3 @@ export const keyStub = {
user: userStub.admin,
} as APIKeyEntity),
};
-
-export const apiKeyCreateStub = {
- name: 'API Key',
-};
diff --git a/server/test/fixtures/asset.stub.ts b/server/test/fixtures/asset.stub.ts
index 119c0b6e5a..45390cf92e 100644
--- a/server/test/fixtures/asset.stub.ts
+++ b/server/test/fixtures/asset.stub.ts
@@ -523,37 +523,6 @@ export const assetStub = {
},
} as AssetEntity),
- liveMotionWithThumb: Object.freeze({
- id: fileStub.livePhotoMotion.uuid,
- status: AssetStatus.ACTIVE,
- originalPath: fileStub.livePhotoMotion.originalPath,
- ownerId: authStub.user1.user.id,
- type: AssetType.VIDEO,
- isVisible: false,
- fileModifiedAt: new Date('2022-06-19T23:41:36.910Z'),
- fileCreatedAt: new Date('2022-06-19T23:41:36.910Z'),
- files: [
- {
- assetId: 'asset-id',
- type: AssetFileType.PREVIEW,
- path: '/uploads/user-id/thumbs/path.ext',
- createdAt: new Date('2023-02-23T05:06:29.716Z'),
- updatedAt: new Date('2023-02-23T05:06:29.716Z'),
- },
- {
- assetId: 'asset-id',
- type: AssetFileType.THUMBNAIL,
- path: '/uploads/user-id/webp/path.ext',
- createdAt: new Date('2023-02-23T05:06:29.716Z'),
- updatedAt: new Date('2023-02-23T05:06:29.716Z'),
- },
- ],
- exifInfo: {
- fileSizeInByte: 100_000,
- timeZone: `America/New_York`,
- },
- } as AssetEntity),
-
livePhotoStillAsset: Object.freeze({
id: 'live-photo-still-asset',
status: AssetStatus.ACTIVE,
@@ -570,22 +539,6 @@ export const assetStub = {
},
} as AssetEntity),
- livePhotoStillAssetWithTheSameLivePhotoMotionAsset: Object.freeze({
- id: 'live-photo-still-asset-1',
- status: AssetStatus.ACTIVE,
- originalPath: fileStub.livePhotoStill.originalPath,
- ownerId: authStub.user1.user.id,
- type: AssetType.IMAGE,
- livePhotoVideoId: 'live-photo-motion-asset',
- isVisible: true,
- fileModifiedAt: new Date('2022-06-19T23:41:36.910Z'),
- fileCreatedAt: new Date('2022-06-19T23:41:36.910Z'),
- exifInfo: {
- fileSizeInByte: 25_000,
- timeZone: `America/New_York`,
- },
- } as AssetEntity),
-
livePhotoWithOriginalFileName: Object.freeze({
id: 'live-photo-still-asset',
status: AssetStatus.ACTIVE,
@@ -645,6 +598,7 @@ export const assetStub = {
duplicateId: null,
isOffline: false,
}),
+
sidecar: Object.freeze<AssetEntity>({
id: 'asset-id',
status: AssetStatus.ACTIVE,
@@ -679,6 +633,7 @@ export const assetStub = {
duplicateId: null,
isOffline: false,
}),
+
sidecarWithoutExt: Object.freeze<AssetEntity>({
id: 'asset-id',
status: AssetStatus.ACTIVE,
@@ -751,45 +706,7 @@ export const assetStub = {
duplicateId: null,
isOffline: false,
}),
- missingFileExtension: Object.freeze<AssetEntity>({
- id: 'asset-id',
- status: AssetStatus.ACTIVE,
- deviceAssetId: 'device-asset-id',
- fileModifiedAt: new Date('2023-02-23T05:06:29.716Z'),
- fileCreatedAt: new Date('2023-02-23T05:06:29.716Z'),
- owner: userStub.user1,
- ownerId: 'user-id',
- deviceId: 'device-id',
- originalPath: '/data/user1/photo.jpg',
- checksum: Buffer.from('file hash', 'utf8'),
- type: AssetType.IMAGE,
- files,
- thumbhash: Buffer.from('blablabla', 'base64'),
- encodedVideoPath: null,
- createdAt: new Date('2023-02-23T05:06:29.716Z'),
- updatedAt: new Date('2023-02-23T05:06:29.716Z'),
- localDateTime: new Date('2023-02-23T05:06:29.716Z'),
- isFavorite: true,
- isArchived: false,
- isExternal: true,
- duration: null,
- isVisible: true,
- livePhotoVideo: null,
- livePhotoVideoId: null,
- libraryId: 'library-id',
- library: libraryStub.externalLibrary1,
- tags: [],
- sharedLinks: [],
- originalFileName: 'photo',
- faces: [],
- deletedAt: null,
- sidecarPath: null,
- exifInfo: {
- fileSizeInByte: 5000,
- } as ExifEntity,
- duplicateId: null,
- isOffline: false,
- }),
+
hasFileExtension: Object.freeze<AssetEntity>({
id: 'asset-id',
status: AssetStatus.ACTIVE,
@@ -829,6 +746,7 @@ export const assetStub = {
duplicateId: null,
isOffline: false,
}),
+
imageDng: Object.freeze<AssetEntity>({
id: 'asset-id',
status: AssetStatus.ACTIVE,
@@ -868,6 +786,7 @@ export const assetStub = {
duplicateId: null,
isOffline: false,
}),
+
hasEmbedding: Object.freeze<AssetEntity>({
id: 'asset-id-embedding',
status: AssetStatus.ACTIVE,
@@ -909,6 +828,7 @@ export const assetStub = {
},
isOffline: false,
}),
+
hasDupe: Object.freeze<AssetEntity>({
id: 'asset-id-dupe',
status: AssetStatus.ACTIVE,
diff --git a/server/test/fixtures/audit.stub.ts b/server/test/fixtures/audit.stub.ts
index 3e79a60819..24f78a17ce 100644
--- a/server/test/fixtures/audit.stub.ts
+++ b/server/test/fixtures/audit.stub.ts
@@ -3,22 +3,6 @@ import { DatabaseAction, EntityType } from 'src/enum';
import { authStub } from 'test/fixtures/auth.stub';
export const auditStub = {
- create: Object.freeze<AuditEntity>({
- id: 1,
- entityId: 'asset-created',
- action: DatabaseAction.CREATE,
- entityType: EntityType.ASSET,
- ownerId: authStub.admin.user.id,
- createdAt: new Date(),
- }),
- update: Object.freeze<AuditEntity>({
- id: 2,
- entityId: 'asset-updated',
- action: DatabaseAction.UPDATE,
- entityType: EntityType.ASSET,
- ownerId: authStub.admin.user.id,
- createdAt: new Date(),
- }),
delete: Object.freeze<AuditEntity>({
id: 3,
entityId: 'asset-deleted',
diff --git a/server/test/fixtures/auth.stub.ts b/server/test/fixtures/auth.stub.ts
index bbb53d4db6..2989c0cce1 100644
--- a/server/test/fixtures/auth.stub.ts
+++ b/server/test/fixtures/auth.stub.ts
@@ -35,17 +35,6 @@ export const authStub = {
id: 'token-id',
} as SessionEntity,
}),
- external1: Object.freeze<AuthDto>({
- user: {
- id: 'user-id',
- email: '[email protected]',
- isAdmin: false,
- metadata: [] as UserMetadataEntity[],
- } as UserEntity,
- session: {
- id: 'token-id',
- } as SessionEntity,
- }),
adminSharedLink: Object.freeze<AuthDto>({
user: {
id: 'admin_id',
@@ -76,20 +65,6 @@ export const authStub = {
key: Buffer.from('shared-link-key'),
} as SharedLinkEntity,
}),
- readonlySharedLink: Object.freeze<AuthDto>({
- user: {
- id: 'admin_id',
- email: '[email protected]',
- isAdmin: true,
- metadata: [] as UserMetadataEntity[],
- } as UserEntity,
- sharedLink: {
- id: '123',
- allowUpload: false,
- allowDownload: false,
- showExif: true,
- } as SharedLinkEntity,
- }),
passwordSharedLink: Object.freeze<AuthDto>({
user: {
id: 'admin_id',
@@ -106,35 +81,3 @@ export const authStub = {
} as SharedLinkEntity,
}),
};
-
-export const loginResponseStub = {
- admin: {
- response: {
- accessToken: expect.any(String),
- name: 'Immich Admin',
- isAdmin: true,
- profileImagePath: '',
- shouldChangePassword: true,
- userEmail: '[email protected]',
- userId: expect.any(String),
- },
- },
- user1oauth: {
- accessToken: 'cmFuZG9tLWJ5dGVz',
- userId: 'user-id',
- userEmail: '[email protected]',
- name: 'immich_name',
- profileImagePath: '',
- isAdmin: false,
- shouldChangePassword: false,
- },
- user1password: {
- accessToken: 'cmFuZG9tLWJ5dGVz',
- userId: 'user-id',
- userEmail: '[email protected]',
- name: 'immich_name',
- profileImagePath: '',
- isAdmin: false,
- shouldChangePassword: false,
- },
-};
diff --git a/server/test/fixtures/face.stub.ts b/server/test/fixtures/face.stub.ts
index e8c4592b8b..b8c68d5bf4 100644
--- a/server/test/fixtures/face.stub.ts
+++ b/server/test/fixtures/face.stub.ts
@@ -51,21 +51,6 @@ export const faceStub = {
sourceType: SourceType.MACHINE_LEARNING,
faceSearch: { faceId: 'assetFaceId3', embedding: [1, 2, 3, 4] },
}),
- mergeFace2: Object.freeze<NonNullableProperty<AssetFaceEntity>>({
- id: 'assetFaceId4',
- assetId: assetStub.image1.id,
- asset: assetStub.image1,
- personId: personStub.mergePerson.id,
- person: personStub.mergePerson,
- boundingBoxX1: 0,
- boundingBoxY1: 0,
- boundingBoxX2: 1,
- boundingBoxY2: 1,
- imageHeight: 1024,
- imageWidth: 1024,
- sourceType: SourceType.MACHINE_LEARNING,
- faceSearch: { faceId: 'assetFaceId4', embedding: [1, 2, 3, 4] },
- }),
start: Object.freeze<NonNullableProperty<AssetFaceEntity>>({
id: 'assetFaceId5',
assetId: assetStub.image.id,
diff --git a/server/test/fixtures/library.stub.ts b/server/test/fixtures/library.stub.ts
index 1a83ffe5d7..b2e132da3e 100644
--- a/server/test/fixtures/library.stub.ts
+++ b/server/test/fixtures/library.stub.ts
@@ -1,6 +1,3 @@
-import { join } from 'node:path';
-import { APP_MEDIA_LOCATION } from 'src/constants';
-import { THUMBNAIL_DIR } from 'src/cores/storage.core';
import { LibraryEntity } from 'src/entities/library.entity';
import { userStub } from 'test/fixtures/user.stub';
@@ -53,18 +50,6 @@ export const libraryStub = {
refreshedAt: null,
exclusionPatterns: [],
}),
- externalLibraryWithExclusionPattern: Object.freeze<LibraryEntity>({
- id: 'library-id',
- name: 'test_library',
- assets: [],
- owner: userStub.admin,
- 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',
@@ -83,7 +68,7 @@ export const libraryStub = {
assets: [],
owner: userStub.admin,
ownerId: 'user-id',
- importPaths: [join(THUMBNAIL_DIR, 'library'), '/xyz', join(APP_MEDIA_LOCATION, 'library')],
+ importPaths: ['upload/thumbs', '/xyz', 'upload/library'],
createdAt: new Date('2023-01-01'),
updatedAt: new Date('2023-01-01'),
refreshedAt: null,
diff --git a/server/test/fixtures/person.stub.ts b/server/test/fixtures/person.stub.ts
index 3584d0486e..544894b31e 100644
--- a/server/test/fixtures/person.stub.ts
+++ b/server/test/fixtures/person.stub.ts
@@ -44,20 +44,6 @@ export const personStub = {
faceAsset: null,
isHidden: false,
}),
- noBirthDate: Object.freeze<PersonEntity>({
- id: 'person-1',
- createdAt: new Date('2021-01-01'),
- updatedAt: new Date('2021-01-01'),
- ownerId: userStub.admin.id,
- owner: userStub.admin,
- name: 'Person 1',
- birthDate: null,
- thumbnailPath: '/path/to/thumbnail.jpg',
- faces: [],
- faceAssetId: null,
- faceAsset: null,
- isHidden: false,
- }),
withBirthDate: Object.freeze<PersonEntity>({
id: 'person-1',
createdAt: new Date('2021-01-01'),
diff --git a/server/test/fixtures/shared-link.stub.ts b/server/test/fixtures/shared-link.stub.ts
index f237e1dea9..e446a6180b 100644
--- a/server/test/fixtures/shared-link.stub.ts
+++ b/server/test/fixtures/shared-link.stub.ts
@@ -309,21 +309,6 @@ export const sharedLinkResponseStub = {
type: SharedLinkType.ALBUM,
userId: 'admin_id',
}),
- readonly: Object.freeze<SharedLinkResponseDto>({
- id: '123',
- userId: 'admin_id',
- key: sharedLinkBytes.toString('base64url'),
- type: SharedLinkType.ALBUM,
- createdAt: today,
- expiresAt: tomorrow,
- description: null,
- password: null,
- allowUpload: false,
- allowDownload: false,
- showMetadata: true,
- album: albumResponse,
- assets: [assetResponse],
- }),
readonlyNoMetadata: Object.freeze<SharedLinkResponseDto>({
id: '123',
userId: 'admin_id',
diff --git a/server/test/fixtures/user.stub.ts b/server/test/fixtures/user.stub.ts
index 6f3a819eef..b65cd6b395 100644
--- a/server/test/fixtures/user.stub.ts
+++ b/server/test/fixtures/user.stub.ts
@@ -2,30 +2,6 @@ import { UserEntity } from 'src/entities/user.entity';
import { UserAvatarColor, UserMetadataKey } from 'src/enum';
import { authStub } from 'test/fixtures/auth.stub';
-export const userDto = {
- user1: {
- email: '[email protected]',
- password: 'Password123',
- name: 'User 1',
- },
- user2: {
- email: '[email protected]',
- password: 'Password123',
- name: 'User 2',
- },
- user3: {
- email: '[email protected]',
- password: 'Password123',
- name: 'User 3',
- },
- userWithQuota: {
- email: '[email protected]',
- password: 'Password123',
- name: 'User with quota',
- quotaSizeInBytes: 42,
- },
-};
-
export const userStub = {
admin: Object.freeze<UserEntity>({
...authStub.admin.user,
@@ -100,22 +76,6 @@ export const userStub = {
quotaSizeInBytes: null,
quotaUsageInBytes: 0,
}),
- externalPathRoot: Object.freeze<UserEntity>({
- ...authStub.user1.user,
- password: 'immich_password',
- name: 'immich_name',
- storageLabel: 'label-1',
- oauthId: '',
- shouldChangePassword: false,
- profileImagePath: '',
- createdAt: new Date('2021-01-01'),
- deletedAt: null,
- updatedAt: new Date('2021-01-01'),
- tags: [],
- assets: [],
- quotaSizeInBytes: null,
- quotaUsageInBytes: 0,
- }),
profilePath: Object.freeze<UserEntity>({
...authStub.user1.user,
password: 'immich_password',
diff --git a/server/test/repositories/asset.repository.mock.ts b/server/test/repositories/asset.repository.mock.ts
index 50fff31e55..982273ff69 100644
--- a/server/test/repositories/asset.repository.mock.ts
+++ b/server/test/repositories/asset.repository.mock.ts
@@ -17,7 +17,6 @@ export const newAssetRepositoryMock = (): Mocked<IAssetRepository> => {
getByChecksum: vitest.fn(),
getByChecksums: vitest.fn(),
getUploadAssetIdByChecksum: vitest.fn(),
- getWith: vitest.fn(),
getRandom: vitest.fn(),
getLastUpdatedAssetForAlbumId: vitest.fn(),
getAll: vitest.fn().mockResolvedValue({ items: [], hasNextPage: false }),
diff --git a/server/test/repositories/database.repository.mock.ts b/server/test/repositories/database.repository.mock.ts
index 0e1d4ab3e7..da6417a38c 100644
--- a/server/test/repositories/database.repository.mock.ts
+++ b/server/test/repositories/database.repository.mock.ts
@@ -9,7 +9,6 @@ export const newDatabaseRepositoryMock = (): Mocked<IDatabaseRepository> => {
getPostgresVersion: vitest.fn().mockResolvedValue('14.10 (Debian 14.10-1.pgdg120+1)'),
getPostgresVersionRange: vitest.fn().mockReturnValue('>=14.0.0'),
createExtension: vitest.fn().mockResolvedValue(void 0),
- updateExtension: vitest.fn(),
updateVectorExtension: vitest.fn(),
reindex: vitest.fn(),
shouldReindex: vitest.fn(),
diff --git a/server/test/repositories/map.repository.mock.ts b/server/test/repositories/map.repository.mock.ts
index 95965522e3..703e8696f1 100644
--- a/server/test/repositories/map.repository.mock.ts
+++ b/server/test/repositories/map.repository.mock.ts
@@ -6,6 +6,5 @@ export const newMapRepositoryMock = (): Mocked<IMapRepository> => {
init: vitest.fn(),
reverseGeocode: vitest.fn(),
getMapMarkers: vitest.fn(),
- fetchStyle: vitest.fn(),
};
};
diff --git a/server/test/repositories/person.repository.mock.ts b/server/test/repositories/person.repository.mock.ts
index 286c527038..d7b92d3eab 100644
--- a/server/test/repositories/person.repository.mock.ts
+++ b/server/test/repositories/person.repository.mock.ts
@@ -16,7 +16,6 @@ export const newPersonRepositoryMock = (): Mocked<IPersonRepository> => {
update: vitest.fn(),
updateAll: vitest.fn(),
delete: vitest.fn(),
- deleteAll: vitest.fn(),
deleteFaces: vitest.fn(),
getStatistics: vitest.fn(),
@@ -26,7 +25,6 @@ export const newPersonRepositoryMock = (): Mocked<IPersonRepository> => {
reassignFaces: vitest.fn(),
unassignFaces: vitest.fn(),
- createFaces: vitest.fn(),
refreshFaces: vitest.fn(),
getFaces: vitest.fn(),
reassignFace: vitest.fn(),