You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-08 23:07:06 +02:00
refactor: enum casing (#19946)
This commit is contained in:
22
server/test/fixtures/album.stub.ts
vendored
22
server/test/fixtures/album.stub.ts
vendored
@ -19,7 +19,7 @@ export const albumStub = {
|
||||
sharedLinks: [],
|
||||
albumUsers: [],
|
||||
isActivityEnabled: true,
|
||||
order: AssetOrder.DESC,
|
||||
order: AssetOrder.Desc,
|
||||
updateId: '42',
|
||||
}),
|
||||
sharedWithUser: Object.freeze({
|
||||
@ -38,11 +38,11 @@ export const albumStub = {
|
||||
albumUsers: [
|
||||
{
|
||||
user: userStub.user1,
|
||||
role: AlbumUserRole.EDITOR,
|
||||
role: AlbumUserRole.Editor,
|
||||
},
|
||||
],
|
||||
isActivityEnabled: true,
|
||||
order: AssetOrder.DESC,
|
||||
order: AssetOrder.Desc,
|
||||
updateId: '42',
|
||||
}),
|
||||
sharedWithMultiple: Object.freeze({
|
||||
@ -61,15 +61,15 @@ export const albumStub = {
|
||||
albumUsers: [
|
||||
{
|
||||
user: userStub.user1,
|
||||
role: AlbumUserRole.EDITOR,
|
||||
role: AlbumUserRole.Editor,
|
||||
},
|
||||
{
|
||||
user: userStub.user2,
|
||||
role: AlbumUserRole.EDITOR,
|
||||
role: AlbumUserRole.Editor,
|
||||
},
|
||||
],
|
||||
isActivityEnabled: true,
|
||||
order: AssetOrder.DESC,
|
||||
order: AssetOrder.Desc,
|
||||
updateId: '42',
|
||||
}),
|
||||
sharedWithAdmin: Object.freeze({
|
||||
@ -88,11 +88,11 @@ export const albumStub = {
|
||||
albumUsers: [
|
||||
{
|
||||
user: userStub.admin,
|
||||
role: AlbumUserRole.EDITOR,
|
||||
role: AlbumUserRole.Editor,
|
||||
},
|
||||
],
|
||||
isActivityEnabled: true,
|
||||
order: AssetOrder.DESC,
|
||||
order: AssetOrder.Desc,
|
||||
updateId: '42',
|
||||
}),
|
||||
oneAsset: Object.freeze({
|
||||
@ -110,7 +110,7 @@ export const albumStub = {
|
||||
sharedLinks: [],
|
||||
albumUsers: [],
|
||||
isActivityEnabled: true,
|
||||
order: AssetOrder.DESC,
|
||||
order: AssetOrder.Desc,
|
||||
updateId: '42',
|
||||
}),
|
||||
twoAssets: Object.freeze({
|
||||
@ -128,7 +128,7 @@ export const albumStub = {
|
||||
sharedLinks: [],
|
||||
albumUsers: [],
|
||||
isActivityEnabled: true,
|
||||
order: AssetOrder.DESC,
|
||||
order: AssetOrder.Desc,
|
||||
updateId: '42',
|
||||
}),
|
||||
emptyWithValidThumbnail: Object.freeze({
|
||||
@ -146,7 +146,7 @@ export const albumStub = {
|
||||
sharedLinks: [],
|
||||
albumUsers: [],
|
||||
isActivityEnabled: true,
|
||||
order: AssetOrder.DESC,
|
||||
order: AssetOrder.Desc,
|
||||
updateId: '42',
|
||||
}),
|
||||
};
|
||||
|
140
server/test/fixtures/asset.stub.ts
vendored
140
server/test/fixtures/asset.stub.ts
vendored
@ -8,19 +8,19 @@ import { userStub } from 'test/fixtures/user.stub';
|
||||
|
||||
export const previewFile: AssetFile = {
|
||||
id: 'file-1',
|
||||
type: AssetFileType.PREVIEW,
|
||||
type: AssetFileType.Preview,
|
||||
path: '/uploads/user-id/thumbs/path.jpg',
|
||||
};
|
||||
|
||||
const thumbnailFile: AssetFile = {
|
||||
id: 'file-2',
|
||||
type: AssetFileType.THUMBNAIL,
|
||||
type: AssetFileType.Thumbnail,
|
||||
path: '/uploads/user-id/webp/path.ext',
|
||||
};
|
||||
|
||||
const fullsizeFile: AssetFile = {
|
||||
id: 'file-3',
|
||||
type: AssetFileType.FULLSIZE,
|
||||
type: AssetFileType.FullSize,
|
||||
path: '/uploads/user-id/fullsize/path.webp',
|
||||
};
|
||||
|
||||
@ -44,7 +44,7 @@ export const assetStub = {
|
||||
id: 'asset-id',
|
||||
ownerId: 'user-id',
|
||||
livePhotoVideoId: null,
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
isExternal: false,
|
||||
checksum: Buffer.from('file hash'),
|
||||
timeZone: null,
|
||||
@ -57,7 +57,7 @@ export const assetStub = {
|
||||
}),
|
||||
noResizePath: Object.freeze({
|
||||
id: 'asset-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
status: AssetStatus.Active,
|
||||
originalFileName: 'IMG_123.jpg',
|
||||
deviceAssetId: 'device-asset-id',
|
||||
fileModifiedAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
@ -68,7 +68,7 @@ export const assetStub = {
|
||||
originalPath: 'upload/library/IMG_123.jpg',
|
||||
files: [thumbnailFile],
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
thumbhash: Buffer.from('blablabla', 'base64'),
|
||||
encodedVideoPath: null,
|
||||
createdAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
@ -89,12 +89,12 @@ export const assetStub = {
|
||||
libraryId: null,
|
||||
stackId: null,
|
||||
updateId: '42',
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
noWebpPath: Object.freeze({
|
||||
id: 'asset-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
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'),
|
||||
@ -104,7 +104,7 @@ export const assetStub = {
|
||||
originalPath: 'upload/library/IMG_456.jpg',
|
||||
files: [previewFile],
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
thumbhash: Buffer.from('blablabla', 'base64'),
|
||||
encodedVideoPath: null,
|
||||
createdAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
@ -128,12 +128,12 @@ export const assetStub = {
|
||||
libraryId: null,
|
||||
stackId: null,
|
||||
updateId: '42',
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
noThumbhash: Object.freeze({
|
||||
id: 'asset-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
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'),
|
||||
@ -143,7 +143,7 @@ export const assetStub = {
|
||||
originalPath: '/original/path.ext',
|
||||
files,
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
thumbhash: null,
|
||||
encodedVideoPath: null,
|
||||
createdAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
@ -164,12 +164,12 @@ export const assetStub = {
|
||||
libraryId: null,
|
||||
stackId: null,
|
||||
updateId: '42',
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
primaryImage: Object.freeze({
|
||||
id: 'primary-asset-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
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'),
|
||||
@ -179,7 +179,7 @@ export const assetStub = {
|
||||
originalPath: '/original/path.jpg',
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
files,
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
thumbhash: Buffer.from('blablabla', 'base64'),
|
||||
encodedVideoPath: null,
|
||||
createdAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
@ -210,12 +210,12 @@ export const assetStub = {
|
||||
isOffline: false,
|
||||
updateId: '42',
|
||||
libraryId: null,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
image: Object.freeze({
|
||||
id: 'asset-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
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'),
|
||||
@ -225,7 +225,7 @@ export const assetStub = {
|
||||
originalPath: '/original/path.jpg',
|
||||
files,
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
thumbhash: Buffer.from('blablabla', 'base64'),
|
||||
encodedVideoPath: null,
|
||||
createdAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
@ -256,7 +256,7 @@ export const assetStub = {
|
||||
projectionType: null,
|
||||
height: 3840,
|
||||
width: 2160,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
trashed: Object.freeze({
|
||||
@ -269,7 +269,7 @@ export const assetStub = {
|
||||
deviceId: 'device-id',
|
||||
originalPath: '/original/path.jpg',
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
files,
|
||||
thumbhash: Buffer.from('blablabla', 'base64'),
|
||||
encodedVideoPath: null,
|
||||
@ -293,16 +293,16 @@ export const assetStub = {
|
||||
} as Exif,
|
||||
duplicateId: null,
|
||||
isOffline: false,
|
||||
status: AssetStatus.TRASHED,
|
||||
status: AssetStatus.Trashed,
|
||||
libraryId: null,
|
||||
stackId: null,
|
||||
updateId: '42',
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
trashedOffline: Object.freeze({
|
||||
id: 'asset-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
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'),
|
||||
@ -311,7 +311,7 @@ export const assetStub = {
|
||||
deviceId: 'device-id',
|
||||
originalPath: '/original/path.jpg',
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
files,
|
||||
thumbhash: Buffer.from('blablabla', 'base64'),
|
||||
encodedVideoPath: null,
|
||||
@ -338,11 +338,11 @@ export const assetStub = {
|
||||
isOffline: true,
|
||||
stackId: null,
|
||||
updateId: '42',
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
archived: Object.freeze({
|
||||
id: 'asset-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
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'),
|
||||
@ -351,7 +351,7 @@ export const assetStub = {
|
||||
deviceId: 'device-id',
|
||||
originalPath: '/original/path.jpg',
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
files,
|
||||
thumbhash: Buffer.from('blablabla', 'base64'),
|
||||
encodedVideoPath: null,
|
||||
@ -378,12 +378,12 @@ export const assetStub = {
|
||||
libraryId: null,
|
||||
stackId: null,
|
||||
updateId: '42',
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
external: Object.freeze({
|
||||
id: 'asset-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
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'),
|
||||
@ -392,7 +392,7 @@ export const assetStub = {
|
||||
deviceId: 'device-id',
|
||||
originalPath: '/data/user1/photo.jpg',
|
||||
checksum: Buffer.from('path hash', 'utf8'),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
files,
|
||||
thumbhash: Buffer.from('blablabla', 'base64'),
|
||||
encodedVideoPath: null,
|
||||
@ -418,12 +418,12 @@ export const assetStub = {
|
||||
updateId: '42',
|
||||
stackId: null,
|
||||
stack: null,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
image1: Object.freeze({
|
||||
id: 'asset-id-1',
|
||||
status: AssetStatus.ACTIVE,
|
||||
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'),
|
||||
@ -432,7 +432,7 @@ export const assetStub = {
|
||||
deviceId: 'device-id',
|
||||
originalPath: '/original/path.ext',
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
files,
|
||||
thumbhash: Buffer.from('blablabla', 'base64'),
|
||||
encodedVideoPath: null,
|
||||
@ -458,12 +458,12 @@ export const assetStub = {
|
||||
stackId: null,
|
||||
libraryId: null,
|
||||
stack: null,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
imageFrom2015: Object.freeze({
|
||||
id: 'asset-id-1',
|
||||
status: AssetStatus.ACTIVE,
|
||||
status: AssetStatus.Active,
|
||||
deviceAssetId: 'device-asset-id',
|
||||
fileModifiedAt: new Date('2015-02-23T05:06:29.716Z'),
|
||||
fileCreatedAt: new Date('2015-02-23T05:06:29.716Z'),
|
||||
@ -473,7 +473,7 @@ export const assetStub = {
|
||||
originalPath: '/original/path.ext',
|
||||
files,
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
thumbhash: Buffer.from('blablabla', 'base64'),
|
||||
encodedVideoPath: null,
|
||||
createdAt: new Date('2015-02-23T05:06:29.716Z'),
|
||||
@ -494,12 +494,12 @@ export const assetStub = {
|
||||
deletedAt: null,
|
||||
duplicateId: null,
|
||||
isOffline: false,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
video: Object.freeze({
|
||||
id: 'asset-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
status: AssetStatus.Active,
|
||||
originalFileName: 'asset-id.ext',
|
||||
deviceAssetId: 'device-asset-id',
|
||||
fileModifiedAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
@ -509,7 +509,7 @@ export const assetStub = {
|
||||
deviceId: 'device-id',
|
||||
originalPath: '/original/path.ext',
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.VIDEO,
|
||||
type: AssetType.Video,
|
||||
files: [previewFile],
|
||||
thumbhash: null,
|
||||
encodedVideoPath: null,
|
||||
@ -535,15 +535,15 @@ export const assetStub = {
|
||||
updateId: '42',
|
||||
libraryId: null,
|
||||
stackId: null,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
livePhotoMotionAsset: Object.freeze({
|
||||
status: AssetStatus.ACTIVE,
|
||||
status: AssetStatus.Active,
|
||||
id: fileStub.livePhotoMotion.uuid,
|
||||
originalPath: fileStub.livePhotoMotion.originalPath,
|
||||
ownerId: authStub.user1.user.id,
|
||||
type: AssetType.VIDEO,
|
||||
type: AssetType.Video,
|
||||
fileModifiedAt: new Date('2022-06-19T23:41:36.910Z'),
|
||||
fileCreatedAt: new Date('2022-06-19T23:41:36.910Z'),
|
||||
exifInfo: {
|
||||
@ -551,15 +551,15 @@ export const assetStub = {
|
||||
timeZone: `America/New_York`,
|
||||
},
|
||||
libraryId: null,
|
||||
visibility: AssetVisibility.HIDDEN,
|
||||
visibility: AssetVisibility.Hidden,
|
||||
} as MapAsset & { faces: AssetFace[]; files: AssetFile[]; exifInfo: Exif }),
|
||||
|
||||
livePhotoStillAsset: Object.freeze({
|
||||
id: 'live-photo-still-asset',
|
||||
status: AssetStatus.ACTIVE,
|
||||
status: AssetStatus.Active,
|
||||
originalPath: fileStub.livePhotoStill.originalPath,
|
||||
ownerId: authStub.user1.user.id,
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
livePhotoVideoId: 'live-photo-motion-asset',
|
||||
fileModifiedAt: new Date('2022-06-19T23:41:36.910Z'),
|
||||
fileCreatedAt: new Date('2022-06-19T23:41:36.910Z'),
|
||||
@ -569,16 +569,16 @@ export const assetStub = {
|
||||
},
|
||||
files,
|
||||
faces: [] as AssetFace[],
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
} as MapAsset & { faces: AssetFace[] }),
|
||||
|
||||
livePhotoWithOriginalFileName: Object.freeze({
|
||||
id: 'live-photo-still-asset',
|
||||
status: AssetStatus.ACTIVE,
|
||||
status: AssetStatus.Active,
|
||||
originalPath: fileStub.livePhotoStill.originalPath,
|
||||
originalFileName: fileStub.livePhotoStill.originalName,
|
||||
ownerId: authStub.user1.user.id,
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
livePhotoVideoId: 'live-photo-motion-asset',
|
||||
fileModifiedAt: new Date('2022-06-19T23:41:36.910Z'),
|
||||
fileCreatedAt: new Date('2022-06-19T23:41:36.910Z'),
|
||||
@ -588,12 +588,12 @@ export const assetStub = {
|
||||
},
|
||||
libraryId: null,
|
||||
faces: [] as AssetFace[],
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
} as MapAsset & { faces: AssetFace[] }),
|
||||
|
||||
withLocation: Object.freeze({
|
||||
id: 'asset-with-favorite-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
status: AssetStatus.Active,
|
||||
deviceAssetId: 'device-asset-id',
|
||||
fileModifiedAt: new Date('2023-02-22T05:06:29.716Z'),
|
||||
fileCreatedAt: new Date('2023-02-22T05:06:29.716Z'),
|
||||
@ -603,7 +603,7 @@ export const assetStub = {
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
originalPath: '/original/path.ext',
|
||||
sidecarPath: null,
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
files: [previewFile],
|
||||
thumbhash: null,
|
||||
encodedVideoPath: null,
|
||||
@ -633,12 +633,12 @@ export const assetStub = {
|
||||
duplicateId: null,
|
||||
isOffline: false,
|
||||
tags: [],
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
sidecar: Object.freeze({
|
||||
id: 'asset-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
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'),
|
||||
@ -648,7 +648,7 @@ export const assetStub = {
|
||||
originalPath: '/original/path.ext',
|
||||
thumbhash: null,
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
files: [previewFile],
|
||||
encodedVideoPath: null,
|
||||
createdAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
@ -669,12 +669,12 @@ export const assetStub = {
|
||||
updateId: 'foo',
|
||||
libraryId: null,
|
||||
stackId: null,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
sidecarWithoutExt: Object.freeze({
|
||||
id: 'asset-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
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'),
|
||||
@ -684,7 +684,7 @@ export const assetStub = {
|
||||
originalPath: '/original/path.ext',
|
||||
thumbhash: null,
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
files: [previewFile],
|
||||
encodedVideoPath: null,
|
||||
createdAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
@ -702,12 +702,12 @@ export const assetStub = {
|
||||
deletedAt: null,
|
||||
duplicateId: null,
|
||||
isOffline: false,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
hasEncodedVideo: Object.freeze({
|
||||
id: 'asset-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
status: AssetStatus.Active,
|
||||
originalFileName: 'asset-id.ext',
|
||||
deviceAssetId: 'device-asset-id',
|
||||
fileModifiedAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
@ -717,7 +717,7 @@ export const assetStub = {
|
||||
deviceId: 'device-id',
|
||||
originalPath: '/original/path.ext',
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.VIDEO,
|
||||
type: AssetType.Video,
|
||||
files: [previewFile],
|
||||
thumbhash: null,
|
||||
encodedVideoPath: '/encoded/video/path.mp4',
|
||||
@ -742,12 +742,12 @@ export const assetStub = {
|
||||
libraryId: null,
|
||||
stackId: null,
|
||||
stack: null,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
hasFileExtension: Object.freeze({
|
||||
id: 'asset-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
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'),
|
||||
@ -756,7 +756,7 @@ export const assetStub = {
|
||||
deviceId: 'device-id',
|
||||
originalPath: '/data/user1/photo.jpg',
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
files,
|
||||
thumbhash: Buffer.from('blablabla', 'base64'),
|
||||
encodedVideoPath: null,
|
||||
@ -779,12 +779,12 @@ export const assetStub = {
|
||||
} as Exif,
|
||||
duplicateId: null,
|
||||
isOffline: false,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
imageDng: Object.freeze({
|
||||
id: 'asset-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
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'),
|
||||
@ -793,7 +793,7 @@ export const assetStub = {
|
||||
deviceId: 'device-id',
|
||||
originalPath: '/original/path.dng',
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
files,
|
||||
thumbhash: Buffer.from('blablabla', 'base64'),
|
||||
encodedVideoPath: null,
|
||||
@ -820,12 +820,12 @@ export const assetStub = {
|
||||
updateId: '42',
|
||||
libraryId: null,
|
||||
stackId: null,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
|
||||
imageHif: Object.freeze({
|
||||
id: 'asset-id',
|
||||
status: AssetStatus.ACTIVE,
|
||||
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'),
|
||||
@ -834,7 +834,7 @@ export const assetStub = {
|
||||
deviceId: 'device-id',
|
||||
originalPath: '/original/path.hif',
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
files,
|
||||
thumbhash: Buffer.from('blablabla', 'base64'),
|
||||
encodedVideoPath: null,
|
||||
@ -861,6 +861,6 @@ export const assetStub = {
|
||||
updateId: '42',
|
||||
libraryId: null,
|
||||
stackId: null,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
}),
|
||||
};
|
||||
|
16
server/test/fixtures/face.stub.ts
vendored
16
server/test/fixtures/face.stub.ts
vendored
@ -20,7 +20,7 @@ export const faceStub = {
|
||||
boundingBoxY2: 1,
|
||||
imageHeight: 1024,
|
||||
imageWidth: 1024,
|
||||
sourceType: SourceType.MACHINE_LEARNING,
|
||||
sourceType: SourceType.MachineLearning,
|
||||
faceSearch: { faceId: 'assetFaceId1', embedding: '[1, 2, 3, 4]' },
|
||||
deletedAt: new Date(),
|
||||
}),
|
||||
@ -36,7 +36,7 @@ export const faceStub = {
|
||||
boundingBoxY2: 1,
|
||||
imageHeight: 1024,
|
||||
imageWidth: 1024,
|
||||
sourceType: SourceType.MACHINE_LEARNING,
|
||||
sourceType: SourceType.MachineLearning,
|
||||
faceSearch: { faceId: 'assetFaceId2', embedding: '[1, 2, 3, 4]' },
|
||||
deletedAt: null,
|
||||
}),
|
||||
@ -52,7 +52,7 @@ export const faceStub = {
|
||||
boundingBoxY2: 1,
|
||||
imageHeight: 1024,
|
||||
imageWidth: 1024,
|
||||
sourceType: SourceType.MACHINE_LEARNING,
|
||||
sourceType: SourceType.MachineLearning,
|
||||
faceSearch: { faceId: 'assetFaceId3', embedding: '[1, 2, 3, 4]' },
|
||||
deletedAt: null,
|
||||
}),
|
||||
@ -68,7 +68,7 @@ export const faceStub = {
|
||||
boundingBoxY2: 1,
|
||||
imageHeight: 1024,
|
||||
imageWidth: 1024,
|
||||
sourceType: SourceType.MACHINE_LEARNING,
|
||||
sourceType: SourceType.MachineLearning,
|
||||
faceSearch: { faceId: 'assetFaceId8', embedding: '[1, 2, 3, 4]' },
|
||||
deletedAt: null,
|
||||
}),
|
||||
@ -84,7 +84,7 @@ export const faceStub = {
|
||||
boundingBoxY2: 1,
|
||||
imageHeight: 1024,
|
||||
imageWidth: 1024,
|
||||
sourceType: SourceType.MACHINE_LEARNING,
|
||||
sourceType: SourceType.MachineLearning,
|
||||
faceSearch: { faceId: 'assetFaceId9', embedding: '[1, 2, 3, 4]' },
|
||||
deletedAt: null,
|
||||
}),
|
||||
@ -100,7 +100,7 @@ export const faceStub = {
|
||||
boundingBoxY2: 200,
|
||||
imageHeight: 500,
|
||||
imageWidth: 400,
|
||||
sourceType: SourceType.EXIF,
|
||||
sourceType: SourceType.Exif,
|
||||
deletedAt: null,
|
||||
}),
|
||||
fromExif2: Object.freeze({
|
||||
@ -115,7 +115,7 @@ export const faceStub = {
|
||||
boundingBoxY2: 1,
|
||||
imageHeight: 1024,
|
||||
imageWidth: 1024,
|
||||
sourceType: SourceType.EXIF,
|
||||
sourceType: SourceType.Exif,
|
||||
deletedAt: null,
|
||||
}),
|
||||
withBirthDate: Object.freeze({
|
||||
@ -130,7 +130,7 @@ export const faceStub = {
|
||||
boundingBoxY2: 1,
|
||||
imageHeight: 1024,
|
||||
imageWidth: 1024,
|
||||
sourceType: SourceType.MACHINE_LEARNING,
|
||||
sourceType: SourceType.MachineLearning,
|
||||
deletedAt: null,
|
||||
}),
|
||||
};
|
||||
|
14
server/test/fixtures/person.stub.ts
vendored
14
server/test/fixtures/person.stub.ts
vendored
@ -176,7 +176,7 @@ export const personThumbnailStub = {
|
||||
y2: 505,
|
||||
oldHeight: 2880,
|
||||
oldWidth: 2160,
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
originalPath: '/original/path.jpg',
|
||||
exifOrientation: '1',
|
||||
previewPath: previewFile.path,
|
||||
@ -189,7 +189,7 @@ export const personThumbnailStub = {
|
||||
y2: 200,
|
||||
oldHeight: 500,
|
||||
oldWidth: 400,
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
originalPath: '/original/path.jpg',
|
||||
exifOrientation: '1',
|
||||
previewPath: previewFile.path,
|
||||
@ -202,7 +202,7 @@ export const personThumbnailStub = {
|
||||
y2: 495,
|
||||
oldHeight: 500,
|
||||
oldWidth: 500,
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
originalPath: '/original/path.jpg',
|
||||
exifOrientation: '1',
|
||||
previewPath: previewFile.path,
|
||||
@ -215,7 +215,7 @@ export const personThumbnailStub = {
|
||||
y2: 200,
|
||||
oldHeight: 500,
|
||||
oldWidth: 400,
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
originalPath: '/original/path.dng',
|
||||
exifOrientation: '1',
|
||||
previewPath: previewFile.path,
|
||||
@ -228,7 +228,7 @@ export const personThumbnailStub = {
|
||||
y2: 251,
|
||||
oldHeight: 1440,
|
||||
oldWidth: 2162,
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
originalPath: '/original/path.jpg',
|
||||
exifOrientation: '1',
|
||||
previewPath: previewFile.path,
|
||||
@ -241,7 +241,7 @@ export const personThumbnailStub = {
|
||||
y2: 152,
|
||||
oldHeight: 1440,
|
||||
oldWidth: 2162,
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
originalPath: '/original/path.jpg',
|
||||
exifOrientation: '1',
|
||||
previewPath: previewFile.path,
|
||||
@ -254,7 +254,7 @@ export const personThumbnailStub = {
|
||||
y2: 200,
|
||||
oldHeight: 500,
|
||||
oldWidth: 400,
|
||||
type: AssetType.VIDEO,
|
||||
type: AssetType.Video,
|
||||
originalPath: '/original/path.mp4',
|
||||
exifOrientation: '1',
|
||||
previewPath: previewFile.path,
|
||||
|
32
server/test/fixtures/shared-link.stub.ts
vendored
32
server/test/fixtures/shared-link.stub.ts
vendored
@ -49,7 +49,7 @@ const assetResponse: AssetResponseDto = {
|
||||
deviceAssetId: 'device_asset_id_1',
|
||||
ownerId: 'user_id_1',
|
||||
deviceId: 'device_id_1',
|
||||
type: AssetType.VIDEO,
|
||||
type: AssetType.Video,
|
||||
originalMimeType: 'image/jpeg',
|
||||
originalPath: 'fake_path/jpeg',
|
||||
originalFileName: 'asset_1.jpeg',
|
||||
@ -70,12 +70,12 @@ const assetResponse: AssetResponseDto = {
|
||||
isTrashed: false,
|
||||
libraryId: 'library-id',
|
||||
hasMetadata: true,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
};
|
||||
|
||||
const assetResponseWithoutMetadata = {
|
||||
id: 'id_1',
|
||||
type: AssetType.VIDEO,
|
||||
type: AssetType.Video,
|
||||
originalMimeType: 'image/jpeg',
|
||||
thumbhash: null,
|
||||
localDateTime: today,
|
||||
@ -99,7 +99,7 @@ const albumResponse: AlbumResponseDto = {
|
||||
assets: [],
|
||||
assetCount: 1,
|
||||
isActivityEnabled: true,
|
||||
order: AssetOrder.DESC,
|
||||
order: AssetOrder.Desc,
|
||||
};
|
||||
|
||||
export const sharedLinkStub = {
|
||||
@ -107,7 +107,7 @@ export const sharedLinkStub = {
|
||||
id: '123',
|
||||
userId: authStub.admin.user.id,
|
||||
key: sharedLinkBytes,
|
||||
type: SharedLinkType.INDIVIDUAL,
|
||||
type: SharedLinkType.Individual,
|
||||
createdAt: today,
|
||||
expiresAt: tomorrow,
|
||||
allowUpload: true,
|
||||
@ -124,7 +124,7 @@ export const sharedLinkStub = {
|
||||
userId: authStub.admin.user.id,
|
||||
user: userStub.admin,
|
||||
key: sharedLinkBytes,
|
||||
type: SharedLinkType.ALBUM,
|
||||
type: SharedLinkType.Album,
|
||||
createdAt: today,
|
||||
expiresAt: tomorrow,
|
||||
allowUpload: true,
|
||||
@ -141,7 +141,7 @@ export const sharedLinkStub = {
|
||||
userId: authStub.admin.user.id,
|
||||
user: userStub.admin,
|
||||
key: sharedLinkBytes,
|
||||
type: SharedLinkType.ALBUM,
|
||||
type: SharedLinkType.Album,
|
||||
createdAt: today,
|
||||
expiresAt: yesterday,
|
||||
allowUpload: true,
|
||||
@ -157,7 +157,7 @@ export const sharedLinkStub = {
|
||||
id: '123',
|
||||
userId: authStub.admin.user.id,
|
||||
key: sharedLinkBytes,
|
||||
type: SharedLinkType.ALBUM,
|
||||
type: SharedLinkType.Album,
|
||||
createdAt: today,
|
||||
expiresAt: tomorrow,
|
||||
allowUpload: false,
|
||||
@ -182,16 +182,16 @@ export const sharedLinkStub = {
|
||||
albumUsers: [],
|
||||
sharedLinks: [],
|
||||
isActivityEnabled: true,
|
||||
order: AssetOrder.DESC,
|
||||
order: AssetOrder.Desc,
|
||||
assets: [
|
||||
{
|
||||
id: 'id_1',
|
||||
status: AssetStatus.ACTIVE,
|
||||
status: AssetStatus.Active,
|
||||
owner: undefined as unknown as UserAdmin,
|
||||
ownerId: 'user_id_1',
|
||||
deviceAssetId: 'device_asset_id_1',
|
||||
deviceId: 'device_id_1',
|
||||
type: AssetType.VIDEO,
|
||||
type: AssetType.Video,
|
||||
originalPath: 'fake_path/jpeg',
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
fileModifiedAt: today,
|
||||
@ -251,7 +251,7 @@ export const sharedLinkStub = {
|
||||
updateId: '42',
|
||||
libraryId: null,
|
||||
stackId: null,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -260,7 +260,7 @@ export const sharedLinkStub = {
|
||||
id: '123',
|
||||
userId: authStub.admin.user.id,
|
||||
key: sharedLinkBytes,
|
||||
type: SharedLinkType.ALBUM,
|
||||
type: SharedLinkType.Album,
|
||||
createdAt: today,
|
||||
expiresAt: tomorrow,
|
||||
allowUpload: true,
|
||||
@ -286,7 +286,7 @@ export const sharedLinkResponseStub = {
|
||||
id: '123',
|
||||
key: sharedLinkBytes.toString('base64url'),
|
||||
showMetadata: true,
|
||||
type: SharedLinkType.ALBUM,
|
||||
type: SharedLinkType.Album,
|
||||
userId: 'admin_id',
|
||||
}),
|
||||
expired: Object.freeze<SharedLinkResponseDto>({
|
||||
@ -301,14 +301,14 @@ export const sharedLinkResponseStub = {
|
||||
id: '123',
|
||||
key: sharedLinkBytes.toString('base64url'),
|
||||
showMetadata: true,
|
||||
type: SharedLinkType.ALBUM,
|
||||
type: SharedLinkType.Album,
|
||||
userId: 'admin_id',
|
||||
}),
|
||||
readonlyNoMetadata: Object.freeze<SharedLinkResponseDto>({
|
||||
id: '123',
|
||||
userId: 'admin_id',
|
||||
key: sharedLinkBytes.toString('base64url'),
|
||||
type: SharedLinkType.ALBUM,
|
||||
type: SharedLinkType.Album,
|
||||
createdAt: today,
|
||||
expiresAt: tomorrow,
|
||||
description: null,
|
||||
|
6
server/test/fixtures/user.stub.ts
vendored
6
server/test/fixtures/user.stub.ts
vendored
@ -5,7 +5,7 @@ import { authStub } from 'test/fixtures/auth.stub';
|
||||
export const userStub = {
|
||||
admin: <UserAdmin>{
|
||||
...authStub.admin.user,
|
||||
status: UserStatus.ACTIVE,
|
||||
status: UserStatus.Active,
|
||||
profileChangedAt: new Date('2021-01-01'),
|
||||
name: 'admin_name',
|
||||
id: 'admin_id',
|
||||
@ -23,7 +23,7 @@ export const userStub = {
|
||||
},
|
||||
user1: <UserAdmin>{
|
||||
...authStub.user1.user,
|
||||
status: UserStatus.ACTIVE,
|
||||
status: UserStatus.Active,
|
||||
profileChangedAt: new Date('2021-01-01'),
|
||||
name: 'immich_name',
|
||||
storageLabel: null,
|
||||
@ -40,7 +40,7 @@ export const userStub = {
|
||||
},
|
||||
user2: <UserAdmin>{
|
||||
...authStub.user2.user,
|
||||
status: UserStatus.ACTIVE,
|
||||
status: UserStatus.Active,
|
||||
profileChangedAt: new Date('2021-01-01'),
|
||||
metadata: [],
|
||||
name: 'immich_name',
|
||||
|
@ -182,7 +182,7 @@ export class MediumTestContext<S extends BaseService = BaseService> {
|
||||
}
|
||||
|
||||
async newAlbumUser(dto: { albumId: string; userId: string; role?: AlbumUserRole }) {
|
||||
const { albumId, userId, role = AlbumUserRole.EDITOR } = dto;
|
||||
const { albumId, userId, role = AlbumUserRole.Editor } = dto;
|
||||
const result = await this.get(AlbumUserRepository).create({ albumsId: albumId, usersId: userId, role });
|
||||
return { albumUser: { albumId, userId, role }, result };
|
||||
}
|
||||
@ -370,14 +370,14 @@ const assetInsert = (asset: Partial<Insertable<AssetTable>> = {}) => {
|
||||
deviceId: '',
|
||||
originalFileName: '',
|
||||
checksum: randomBytes(32),
|
||||
type: AssetType.IMAGE,
|
||||
type: AssetType.Image,
|
||||
originalPath: '/path/to/something.jpg',
|
||||
ownerId: '@immich.cloud',
|
||||
isFavorite: false,
|
||||
fileCreatedAt: now,
|
||||
fileModifiedAt: now,
|
||||
localDateTime: now,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
};
|
||||
|
||||
return {
|
||||
@ -423,7 +423,7 @@ const assetFaceInsert = (assetFace: Partial<AssetFace> & { assetId: string }) =>
|
||||
imageHeight: assetFace.imageHeight ?? 10,
|
||||
imageWidth: assetFace.imageWidth ?? 10,
|
||||
personId: assetFace.personId ?? null,
|
||||
sourceType: assetFace.sourceType ?? SourceType.MACHINE_LEARNING,
|
||||
sourceType: assetFace.sourceType ?? SourceType.MachineLearning,
|
||||
};
|
||||
|
||||
return {
|
||||
@ -516,7 +516,7 @@ const memoryInsert = (memory: Partial<Insertable<MemoryTable>> = {}) => {
|
||||
createdAt: date,
|
||||
updatedAt: date,
|
||||
deletedAt: null,
|
||||
type: MemoryType.ON_THIS_DAY,
|
||||
type: MemoryType.OnThisDay,
|
||||
data: { year: 2025 },
|
||||
showAt: null,
|
||||
hideAt: null,
|
||||
|
@ -102,7 +102,7 @@ describe(AuthService.name, () => {
|
||||
it('should logout', async () => {
|
||||
const { sut } = setup();
|
||||
const auth = factory.auth();
|
||||
await expect(sut.logout(auth, AuthType.PASSWORD)).resolves.toEqual({
|
||||
await expect(sut.logout(auth, AuthType.Password)).resolves.toEqual({
|
||||
successful: true,
|
||||
redirectUri: '/auth/login?autoLaunch=0',
|
||||
});
|
||||
@ -118,7 +118,7 @@ describe(AuthService.name, () => {
|
||||
eventRepo.emit.mockResolvedValue();
|
||||
|
||||
await expect(sessionRepo.get(session.id)).resolves.toEqual(expect.objectContaining({ id: session.id }));
|
||||
await expect(sut.logout(auth, AuthType.PASSWORD)).resolves.toEqual({
|
||||
await expect(sut.logout(auth, AuthType.Password)).resolves.toEqual({
|
||||
successful: true,
|
||||
redirectUri: '/auth/login?autoLaunch=0',
|
||||
});
|
||||
|
@ -45,7 +45,7 @@ describe(MemoryService.name, () => {
|
||||
const { user } = await ctx.newUser();
|
||||
const auth = factory.auth({ user });
|
||||
const dto = {
|
||||
type: MemoryType.ON_THIS_DAY,
|
||||
type: MemoryType.OnThisDay,
|
||||
data: { year: 2021 },
|
||||
memoryAt: new Date(2021),
|
||||
};
|
||||
@ -70,7 +70,7 @@ describe(MemoryService.name, () => {
|
||||
const { asset: asset2 } = await ctx.newAsset({ ownerId: user.id });
|
||||
const auth = factory.auth({ user });
|
||||
const dto = {
|
||||
type: MemoryType.ON_THIS_DAY,
|
||||
type: MemoryType.OnThisDay,
|
||||
data: { year: 2021 },
|
||||
memoryAt: new Date(2021),
|
||||
assetIds: [asset1.id, asset2.id],
|
||||
@ -92,7 +92,7 @@ describe(MemoryService.name, () => {
|
||||
const { asset: asset2 } = await ctx.newAsset({ ownerId: user2.id });
|
||||
const auth = factory.auth({ user: user1 });
|
||||
const dto = {
|
||||
type: MemoryType.ON_THIS_DAY,
|
||||
type: MemoryType.OnThisDay,
|
||||
data: { year: 2021 },
|
||||
memoryAt: new Date(2021),
|
||||
assetIds: [asset1.id, asset2.id],
|
||||
@ -124,8 +124,8 @@ describe(MemoryService.name, () => {
|
||||
ctx.newExif({ assetId: asset.id, make: 'Canon' }),
|
||||
ctx.newJobStatus({ assetId: asset.id }),
|
||||
assetRepo.upsertFiles([
|
||||
{ assetId: asset.id, type: AssetFileType.PREVIEW, path: '/path/to/preview.jpg' },
|
||||
{ assetId: asset.id, type: AssetFileType.THUMBNAIL, path: '/path/to/thumbnail.jpg' },
|
||||
{ assetId: asset.id, type: AssetFileType.Preview, path: '/path/to/preview.jpg' },
|
||||
{ assetId: asset.id, type: AssetFileType.Thumbnail, path: '/path/to/thumbnail.jpg' },
|
||||
]),
|
||||
]);
|
||||
|
||||
@ -178,8 +178,8 @@ describe(MemoryService.name, () => {
|
||||
ctx.newExif({ assetId: asset.id, make: 'Canon' }),
|
||||
ctx.newJobStatus({ assetId: asset.id }),
|
||||
assetRepo.upsertFiles([
|
||||
{ assetId: asset.id, type: AssetFileType.PREVIEW, path: '/path/to/preview.jpg' },
|
||||
{ assetId: asset.id, type: AssetFileType.THUMBNAIL, path: '/path/to/thumbnail.jpg' },
|
||||
{ assetId: asset.id, type: AssetFileType.Preview, path: '/path/to/preview.jpg' },
|
||||
{ assetId: asset.id, type: AssetFileType.Thumbnail, path: '/path/to/thumbnail.jpg' },
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ describe(TimelineService.name, () => {
|
||||
it('should return error if time bucket is requested with partners asset and archived', async () => {
|
||||
const { sut } = setup();
|
||||
const auth = factory.auth();
|
||||
const response1 = sut.getTimeBuckets(auth, { withPartners: true, visibility: AssetVisibility.ARCHIVE });
|
||||
const response1 = sut.getTimeBuckets(auth, { withPartners: true, visibility: AssetVisibility.Archive });
|
||||
await expect(response1).rejects.toBeInstanceOf(BadRequestException);
|
||||
await expect(response1).rejects.toThrow(
|
||||
'withPartners is only supported for non-archived, non-trashed, non-favorited assets',
|
||||
|
@ -16,7 +16,7 @@ import { getKyselyDB } from 'test/utils';
|
||||
let defaultDatabase: Kysely<DB>;
|
||||
|
||||
const setup = (db?: Kysely<DB>) => {
|
||||
process.env.IMMICH_ENV = ImmichEnvironment.TESTING;
|
||||
process.env.IMMICH_ENV = ImmichEnvironment.Testing;
|
||||
|
||||
return newMediumService(UserService, {
|
||||
database: db || defaultDatabase,
|
||||
@ -140,7 +140,7 @@ describe(UserService.name, () => {
|
||||
const { sut, ctx } = setup();
|
||||
const jobMock = ctx.getMock(JobRepository);
|
||||
jobMock.queueAll.mockResolvedValue(void 0);
|
||||
await expect(sut.handleUserDeleteCheck()).resolves.toEqual(JobStatus.SUCCESS);
|
||||
await expect(sut.handleUserDeleteCheck()).resolves.toEqual(JobStatus.Success);
|
||||
expect(jobMock.queueAll).toHaveBeenCalledExactlyOnceWith([]);
|
||||
});
|
||||
|
||||
@ -149,10 +149,8 @@ describe(UserService.name, () => {
|
||||
const jobMock = ctx.getMock(JobRepository);
|
||||
const { user } = await ctx.newUser({ deletedAt: DateTime.now().minus({ days: 60 }).toJSDate() });
|
||||
jobMock.queueAll.mockResolvedValue(void 0);
|
||||
await expect(sut.handleUserDeleteCheck()).resolves.toEqual(JobStatus.SUCCESS);
|
||||
expect(jobMock.queueAll).toHaveBeenCalledExactlyOnceWith([
|
||||
{ name: JobName.USER_DELETION, data: { id: user.id } },
|
||||
]);
|
||||
await expect(sut.handleUserDeleteCheck()).resolves.toEqual(JobStatus.Success);
|
||||
expect(jobMock.queueAll).toHaveBeenCalledExactlyOnceWith([{ name: JobName.UserDeletion, data: { id: user.id } }]);
|
||||
});
|
||||
|
||||
it('should skip a recently deleted user', async () => {
|
||||
@ -160,7 +158,7 @@ describe(UserService.name, () => {
|
||||
const jobMock = ctx.getMock(JobRepository);
|
||||
await ctx.newUser({ deletedAt: DateTime.now().minus({ days: 5 }).toJSDate() });
|
||||
jobMock.queueAll.mockResolvedValue(void 0);
|
||||
await expect(sut.handleUserDeleteCheck()).resolves.toEqual(JobStatus.SUCCESS);
|
||||
await expect(sut.handleUserDeleteCheck()).resolves.toEqual(JobStatus.Success);
|
||||
expect(jobMock.queueAll).toHaveBeenCalledExactlyOnceWith([]);
|
||||
});
|
||||
|
||||
@ -172,7 +170,7 @@ describe(UserService.name, () => {
|
||||
const config = await sut.getConfig({ withCache: false });
|
||||
config.user.deleteDelay = 30;
|
||||
await sut.updateConfig(config);
|
||||
await expect(sut.handleUserDeleteCheck()).resolves.toEqual(JobStatus.SUCCESS);
|
||||
await expect(sut.handleUserDeleteCheck()).resolves.toEqual(JobStatus.Success);
|
||||
expect(jobMock.queueAll).toHaveBeenCalledExactlyOnceWith([]);
|
||||
});
|
||||
});
|
||||
|
@ -53,7 +53,7 @@ describe(VersionService.name, () => {
|
||||
await versionHistoryRepo.create({ version: 'v1.128.0' });
|
||||
await sut.onBootstrap();
|
||||
|
||||
expect(jobMock.queue).toHaveBeenCalledWith({ name: JobName.MEMORIES_CREATE });
|
||||
expect(jobMock.queue).toHaveBeenCalledWith({ name: JobName.MemoriesCreate });
|
||||
});
|
||||
|
||||
it('should not queue memory creation when upgrading from 1.129.0', async () => {
|
||||
|
@ -25,7 +25,7 @@ describe(SyncRequestType.AlbumAssetExifsV1, () => {
|
||||
await ctx.newExif({ assetId: asset.id, make: 'Canon' });
|
||||
const { album } = await ctx.newAlbum({ ownerId: user2.id });
|
||||
await ctx.newAlbumAsset({ albumId: album.id, assetId: asset.id });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumAssetExifsV1]);
|
||||
expect(response).toHaveLength(1);
|
||||
@ -86,7 +86,7 @@ describe(SyncRequestType.AlbumAssetExifsV1, () => {
|
||||
await ctx.newExif({ assetId: asset.id, make: 'Canon' });
|
||||
const { album } = await ctx.newAlbum({ ownerId: user2.id });
|
||||
await ctx.newAlbumAsset({ albumId: album.id, assetId: asset.id });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: user3.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: user3.id, role: AlbumUserRole.Editor });
|
||||
const { session } = await ctx.newSession({ userId: user3.id });
|
||||
const authUser3 = factory.auth({ session, user: user3 });
|
||||
|
||||
@ -110,7 +110,7 @@ describe(SyncRequestType.AlbumAssetExifsV1, () => {
|
||||
await ctx.newExif({ assetId: asset3User2.id, make: 'asset3User2' });
|
||||
const { album: album1 } = await ctx.newAlbum({ ownerId: user2.id });
|
||||
await ctx.newAlbumAsset({ albumId: album1.id, assetId: asset2User2.id });
|
||||
await ctx.newAlbumUser({ albumId: album1.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album1.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumAssetExifsV1]);
|
||||
expect(response).toHaveLength(1);
|
||||
@ -134,7 +134,7 @@ describe(SyncRequestType.AlbumAssetExifsV1, () => {
|
||||
ctx.newAlbumAsset({ albumId: album2.id, assetId }),
|
||||
),
|
||||
);
|
||||
await ctx.newAlbumUser({ albumId: album2.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album2.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
// should backfill the album user
|
||||
const newResponse = await ctx.syncStream(auth, [SyncRequestType.AlbumAssetExifsV1]);
|
||||
|
@ -41,7 +41,7 @@ describe(SyncRequestType.AlbumAssetsV1, () => {
|
||||
});
|
||||
const { album } = await ctx.newAlbum({ ownerId: user2.id });
|
||||
await ctx.newAlbumAsset({ albumId: album.id, assetId: asset.id });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumAssetsV1]);
|
||||
expect(response).toHaveLength(1);
|
||||
@ -90,7 +90,7 @@ describe(SyncRequestType.AlbumAssetsV1, () => {
|
||||
const { asset } = await ctx.newAsset({ ownerId: user3.id });
|
||||
const { album } = await ctx.newAlbum({ ownerId: user2.id });
|
||||
await ctx.newAlbumAsset({ albumId: album.id, assetId: asset.id });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: user3.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: user3.id, role: AlbumUserRole.Editor });
|
||||
const { session } = await ctx.newSession({ userId: user3.id });
|
||||
const authUser3 = factory.auth({ session, user: user3 });
|
||||
|
||||
@ -111,7 +111,7 @@ describe(SyncRequestType.AlbumAssetsV1, () => {
|
||||
await wait(2);
|
||||
const { album: album1 } = await ctx.newAlbum({ ownerId: user2.id });
|
||||
await ctx.newAlbumAsset({ albumId: album1.id, assetId: asset2User2.id });
|
||||
await ctx.newAlbumUser({ albumId: album1.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album1.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumAssetsV1]);
|
||||
expect(response).toHaveLength(1);
|
||||
@ -135,7 +135,7 @@ describe(SyncRequestType.AlbumAssetsV1, () => {
|
||||
ctx.newAlbumAsset({ albumId: album2.id, assetId }),
|
||||
),
|
||||
);
|
||||
await ctx.newAlbumUser({ albumId: album2.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album2.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
// should backfill the album user
|
||||
const newResponse = await ctx.syncStream(auth, [SyncRequestType.AlbumAssetsV1]);
|
||||
|
@ -73,7 +73,7 @@ describe(SyncRequestType.AlbumToAssetsV1, () => {
|
||||
const { asset } = await ctx.newAsset({ ownerId: auth.user.id });
|
||||
const { album } = await ctx.newAlbum({ ownerId: user2.id });
|
||||
await ctx.newAlbumAsset({ albumId: album.id, assetId: asset.id });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumToAssetsV1]);
|
||||
expect(response).toHaveLength(1);
|
||||
@ -130,7 +130,7 @@ describe(SyncRequestType.AlbumToAssetsV1, () => {
|
||||
await ctx.syncAckAll(auth, response);
|
||||
|
||||
// add user to backfill album
|
||||
await ctx.newAlbumUser({ albumId: album2.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album2.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
// should backfill the album to asset relation
|
||||
const newResponse = await ctx.syncStream(auth, [SyncRequestType.AlbumToAssetsV1]);
|
||||
|
@ -22,7 +22,7 @@ describe(SyncRequestType.AlbumUsersV1, () => {
|
||||
const { auth, ctx } = await setup();
|
||||
const { album } = await ctx.newAlbum({ ownerId: auth.user.id });
|
||||
const { user } = await ctx.newUser();
|
||||
const { albumUser } = await ctx.newAlbumUser({ albumId: album.id, userId: user.id, role: AlbumUserRole.EDITOR });
|
||||
const { albumUser } = await ctx.newAlbumUser({ albumId: album.id, userId: user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
await expect(ctx.syncStream(auth, [SyncRequestType.AlbumUsersV1])).resolves.toEqual([
|
||||
{
|
||||
@ -42,7 +42,7 @@ describe(SyncRequestType.AlbumUsersV1, () => {
|
||||
const { auth, ctx } = await setup();
|
||||
const { user: user1 } = await ctx.newUser();
|
||||
const { album } = await ctx.newAlbum({ ownerId: auth.user.id });
|
||||
const { albumUser } = await ctx.newAlbumUser({ albumId: album.id, userId: user1.id, role: AlbumUserRole.EDITOR });
|
||||
const { albumUser } = await ctx.newAlbumUser({ albumId: album.id, userId: user1.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumUsersV1]);
|
||||
expect(response).toHaveLength(1);
|
||||
@ -67,13 +67,13 @@ describe(SyncRequestType.AlbumUsersV1, () => {
|
||||
const albumUserRepo = ctx.get(AlbumUserRepository);
|
||||
const { user: user1 } = await ctx.newUser();
|
||||
const { album } = await ctx.newAlbum({ ownerId: auth.user.id });
|
||||
const { albumUser } = await ctx.newAlbumUser({ albumId: album.id, userId: user1.id, role: AlbumUserRole.EDITOR });
|
||||
const { albumUser } = await ctx.newAlbumUser({ albumId: album.id, userId: user1.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumUsersV1]);
|
||||
await ctx.syncAckAll(auth, response);
|
||||
await expect(ctx.syncStream(auth, [SyncRequestType.AlbumUsersV1])).resolves.toEqual([]);
|
||||
|
||||
await albumUserRepo.update({ albumsId: album.id, usersId: user1.id }, { role: AlbumUserRole.VIEWER });
|
||||
await albumUserRepo.update({ albumsId: album.id, usersId: user1.id }, { role: AlbumUserRole.Viewer });
|
||||
const newResponse = await ctx.syncStream(auth, [SyncRequestType.AlbumUsersV1]);
|
||||
expect(newResponse).toHaveLength(1);
|
||||
expect(newResponse).toEqual([
|
||||
@ -81,7 +81,7 @@ describe(SyncRequestType.AlbumUsersV1, () => {
|
||||
ack: expect.any(String),
|
||||
data: expect.objectContaining({
|
||||
albumId: albumUser.albumId,
|
||||
role: AlbumUserRole.VIEWER,
|
||||
role: AlbumUserRole.Viewer,
|
||||
userId: albumUser.userId,
|
||||
}),
|
||||
type: SyncEntityType.AlbumUserV1,
|
||||
@ -97,7 +97,7 @@ describe(SyncRequestType.AlbumUsersV1, () => {
|
||||
const albumUserRepo = ctx.get(AlbumUserRepository);
|
||||
const { user: user1 } = await ctx.newUser();
|
||||
const { album } = await ctx.newAlbum({ ownerId: auth.user.id });
|
||||
const { albumUser } = await ctx.newAlbumUser({ albumId: album.id, userId: user1.id, role: AlbumUserRole.EDITOR });
|
||||
const { albumUser } = await ctx.newAlbumUser({ albumId: album.id, userId: user1.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumUsersV1]);
|
||||
expect(response).toHaveLength(1);
|
||||
@ -130,7 +130,7 @@ describe(SyncRequestType.AlbumUsersV1, () => {
|
||||
const { albumUser } = await ctx.newAlbumUser({
|
||||
albumId: album.id,
|
||||
userId: auth.user.id,
|
||||
role: AlbumUserRole.EDITOR,
|
||||
role: AlbumUserRole.Editor,
|
||||
});
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumUsersV1]);
|
||||
@ -157,8 +157,8 @@ describe(SyncRequestType.AlbumUsersV1, () => {
|
||||
const { user: owner } = await ctx.newUser();
|
||||
const { user: user } = await ctx.newUser();
|
||||
const { album } = await ctx.newAlbum({ ownerId: owner.id });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumUsersV1]);
|
||||
expect(response).toHaveLength(2);
|
||||
@ -166,14 +166,14 @@ describe(SyncRequestType.AlbumUsersV1, () => {
|
||||
await ctx.syncAckAll(auth, response);
|
||||
await expect(ctx.syncStream(auth, [SyncRequestType.AlbumUsersV1])).resolves.toEqual([]);
|
||||
|
||||
await albumUserRepo.update({ albumsId: album.id, usersId: user.id }, { role: AlbumUserRole.VIEWER });
|
||||
await albumUserRepo.update({ albumsId: album.id, usersId: user.id }, { role: AlbumUserRole.Viewer });
|
||||
const newResponse = await ctx.syncStream(auth, [SyncRequestType.AlbumUsersV1]);
|
||||
expect(newResponse).toEqual([
|
||||
{
|
||||
ack: expect.any(String),
|
||||
data: expect.objectContaining({
|
||||
albumId: album.id,
|
||||
role: AlbumUserRole.VIEWER,
|
||||
role: AlbumUserRole.Viewer,
|
||||
userId: user.id,
|
||||
}),
|
||||
type: SyncEntityType.AlbumUserV1,
|
||||
@ -190,8 +190,8 @@ describe(SyncRequestType.AlbumUsersV1, () => {
|
||||
const { user: owner } = await ctx.newUser();
|
||||
const { user: user } = await ctx.newUser();
|
||||
const { album } = await ctx.newAlbum({ ownerId: owner.id });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumUsersV1]);
|
||||
expect(response).toHaveLength(2);
|
||||
@ -223,13 +223,13 @@ describe(SyncRequestType.AlbumUsersV1, () => {
|
||||
const { album: album1 } = await ctx.newAlbum({ ownerId: user1.id });
|
||||
const { album: album2 } = await ctx.newAlbum({ ownerId: user1.id });
|
||||
// backfill album user
|
||||
await ctx.newAlbumUser({ albumId: album1.id, userId: user1.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album1.id, userId: user1.id, role: AlbumUserRole.Editor });
|
||||
await wait(2);
|
||||
// initial album user
|
||||
await ctx.newAlbumUser({ albumId: album2.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album2.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
await wait(2);
|
||||
// post checkpoint album user
|
||||
await ctx.newAlbumUser({ albumId: album1.id, userId: user2.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album1.id, userId: user2.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumUsersV1]);
|
||||
expect(response).toHaveLength(1);
|
||||
@ -238,7 +238,7 @@ describe(SyncRequestType.AlbumUsersV1, () => {
|
||||
ack: expect.any(String),
|
||||
data: expect.objectContaining({
|
||||
albumId: album2.id,
|
||||
role: AlbumUserRole.EDITOR,
|
||||
role: AlbumUserRole.Editor,
|
||||
userId: auth.user.id,
|
||||
}),
|
||||
type: SyncEntityType.AlbumUserV1,
|
||||
@ -248,7 +248,7 @@ describe(SyncRequestType.AlbumUsersV1, () => {
|
||||
// ack initial user
|
||||
await ctx.syncAckAll(auth, response);
|
||||
// get access to the backfill album user
|
||||
await ctx.newAlbumUser({ albumId: album1.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album1.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
// should backfill the album user
|
||||
const newResponse = await ctx.syncStream(auth, [SyncRequestType.AlbumUsersV1]);
|
||||
@ -257,7 +257,7 @@ describe(SyncRequestType.AlbumUsersV1, () => {
|
||||
ack: expect.any(String),
|
||||
data: expect.objectContaining({
|
||||
albumId: album1.id,
|
||||
role: AlbumUserRole.EDITOR,
|
||||
role: AlbumUserRole.Editor,
|
||||
userId: user1.id,
|
||||
}),
|
||||
type: SyncEntityType.AlbumUserBackfillV1,
|
||||
@ -271,7 +271,7 @@ describe(SyncRequestType.AlbumUsersV1, () => {
|
||||
ack: expect.any(String),
|
||||
data: expect.objectContaining({
|
||||
albumId: album1.id,
|
||||
role: AlbumUserRole.EDITOR,
|
||||
role: AlbumUserRole.Editor,
|
||||
userId: user2.id,
|
||||
}),
|
||||
type: SyncEntityType.AlbumUserV1,
|
||||
@ -280,7 +280,7 @@ describe(SyncRequestType.AlbumUsersV1, () => {
|
||||
ack: expect.any(String),
|
||||
data: expect.objectContaining({
|
||||
albumId: album1.id,
|
||||
role: AlbumUserRole.EDITOR,
|
||||
role: AlbumUserRole.Editor,
|
||||
userId: auth.user.id,
|
||||
}),
|
||||
type: SyncEntityType.AlbumUserV1,
|
||||
|
@ -101,7 +101,7 @@ describe(SyncRequestType.AlbumsV1, () => {
|
||||
const { auth, ctx } = await setup();
|
||||
const { user: user2 } = await ctx.newUser();
|
||||
const { album } = await ctx.newAlbum({ ownerId: user2.id });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumsV1]);
|
||||
expect(response).toHaveLength(1);
|
||||
@ -121,7 +121,7 @@ describe(SyncRequestType.AlbumsV1, () => {
|
||||
const { auth, ctx } = await setup();
|
||||
const { user: user2 } = await ctx.newUser();
|
||||
const { album } = await ctx.newAlbum({ ownerId: user2.id });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumsV1]);
|
||||
expect(response).toHaveLength(1);
|
||||
@ -153,7 +153,7 @@ describe(SyncRequestType.AlbumsV1, () => {
|
||||
]);
|
||||
|
||||
await ctx.syncAckAll(auth, response);
|
||||
await ctx.newAlbumUser({ userId: auth.user.id, albumId: user2Album.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ userId: auth.user.id, albumId: user2Album.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const newResponse = await ctx.syncStream(auth, [SyncRequestType.AlbumsV1]);
|
||||
expect(newResponse).toHaveLength(1);
|
||||
@ -174,7 +174,7 @@ describe(SyncRequestType.AlbumsV1, () => {
|
||||
const albumRepo = ctx.get(AlbumRepository);
|
||||
const { user: user2 } = await ctx.newUser();
|
||||
const { album } = await ctx.newAlbum({ ownerId: user2.id });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumsV1]);
|
||||
expect(response).toHaveLength(1);
|
||||
@ -202,7 +202,7 @@ describe(SyncRequestType.AlbumsV1, () => {
|
||||
const albumUserRepo = ctx.get(AlbumUserRepository);
|
||||
const { user: user2 } = await ctx.newUser();
|
||||
const { album } = await ctx.newAlbum({ ownerId: user2.id });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.EDITOR });
|
||||
await ctx.newAlbumUser({ albumId: album.id, userId: auth.user.id, role: AlbumUserRole.Editor });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.AlbumsV1]);
|
||||
expect(response).toHaveLength(1);
|
||||
|
@ -22,7 +22,7 @@ describe(SyncEntityType.UserMetadataV1, () => {
|
||||
const { auth, user, ctx } = await setup();
|
||||
|
||||
const userRepo = ctx.get(UserRepository);
|
||||
await userRepo.upsertMetadata(user.id, { key: UserMetadataKey.ONBOARDING, value: { isOnboarded: true } });
|
||||
await userRepo.upsertMetadata(user.id, { key: UserMetadataKey.Onboarding, value: { isOnboarded: true } });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.UserMetadataV1]);
|
||||
expect(response).toHaveLength(1);
|
||||
@ -30,7 +30,7 @@ describe(SyncEntityType.UserMetadataV1, () => {
|
||||
{
|
||||
ack: expect.any(String),
|
||||
data: {
|
||||
key: UserMetadataKey.ONBOARDING,
|
||||
key: UserMetadataKey.Onboarding,
|
||||
userId: user.id,
|
||||
value: { isOnboarded: true },
|
||||
},
|
||||
@ -46,7 +46,7 @@ describe(SyncEntityType.UserMetadataV1, () => {
|
||||
const { auth, user, ctx } = await setup();
|
||||
|
||||
const userRepo = ctx.get(UserRepository);
|
||||
await userRepo.upsertMetadata(user.id, { key: UserMetadataKey.ONBOARDING, value: { isOnboarded: true } });
|
||||
await userRepo.upsertMetadata(user.id, { key: UserMetadataKey.Onboarding, value: { isOnboarded: true } });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.UserMetadataV1]);
|
||||
expect(response).toHaveLength(1);
|
||||
@ -54,7 +54,7 @@ describe(SyncEntityType.UserMetadataV1, () => {
|
||||
{
|
||||
ack: expect.any(String),
|
||||
data: {
|
||||
key: UserMetadataKey.ONBOARDING,
|
||||
key: UserMetadataKey.Onboarding,
|
||||
userId: user.id,
|
||||
value: { isOnboarded: true },
|
||||
},
|
||||
@ -64,14 +64,14 @@ describe(SyncEntityType.UserMetadataV1, () => {
|
||||
|
||||
await ctx.syncAckAll(auth, response);
|
||||
|
||||
await userRepo.upsertMetadata(user.id, { key: UserMetadataKey.ONBOARDING, value: { isOnboarded: false } });
|
||||
await userRepo.upsertMetadata(user.id, { key: UserMetadataKey.Onboarding, value: { isOnboarded: false } });
|
||||
|
||||
const updatedResponse = await ctx.syncStream(auth, [SyncRequestType.UserMetadataV1]);
|
||||
expect(updatedResponse).toEqual([
|
||||
{
|
||||
ack: expect.any(String),
|
||||
data: {
|
||||
key: UserMetadataKey.ONBOARDING,
|
||||
key: UserMetadataKey.Onboarding,
|
||||
userId: user.id,
|
||||
value: { isOnboarded: false },
|
||||
},
|
||||
@ -89,7 +89,7 @@ describe(SyncEntityType.UserMetadataDeleteV1, () => {
|
||||
const { auth, user, ctx } = await setup();
|
||||
|
||||
const userRepo = ctx.get(UserRepository);
|
||||
await userRepo.upsertMetadata(user.id, { key: UserMetadataKey.ONBOARDING, value: { isOnboarded: true } });
|
||||
await userRepo.upsertMetadata(user.id, { key: UserMetadataKey.Onboarding, value: { isOnboarded: true } });
|
||||
|
||||
const response = await ctx.syncStream(auth, [SyncRequestType.UserMetadataV1]);
|
||||
expect(response).toHaveLength(1);
|
||||
@ -97,7 +97,7 @@ describe(SyncEntityType.UserMetadataDeleteV1, () => {
|
||||
{
|
||||
ack: expect.any(String),
|
||||
data: {
|
||||
key: UserMetadataKey.ONBOARDING,
|
||||
key: UserMetadataKey.Onboarding,
|
||||
userId: user.id,
|
||||
value: { isOnboarded: true },
|
||||
},
|
||||
@ -107,14 +107,14 @@ describe(SyncEntityType.UserMetadataDeleteV1, () => {
|
||||
|
||||
await ctx.syncAckAll(auth, response);
|
||||
|
||||
await userRepo.deleteMetadata(auth.user.id, UserMetadataKey.ONBOARDING);
|
||||
await userRepo.deleteMetadata(auth.user.id, UserMetadataKey.Onboarding);
|
||||
|
||||
await expect(ctx.syncStream(auth, [SyncRequestType.UserMetadataV1])).resolves.toEqual([
|
||||
{
|
||||
ack: expect.any(String),
|
||||
data: {
|
||||
userId: user.id,
|
||||
key: UserMetadataKey.ONBOARDING,
|
||||
key: UserMetadataKey.Onboarding,
|
||||
},
|
||||
type: 'UserMetadataDeleteV1',
|
||||
},
|
||||
|
@ -5,7 +5,7 @@ import { Mocked, vitest } from 'vitest';
|
||||
|
||||
const envData: EnvData = {
|
||||
port: 2283,
|
||||
environment: ImmichEnvironment.PRODUCTION,
|
||||
environment: ImmichEnvironment.Production,
|
||||
|
||||
buildMetadata: {},
|
||||
bull: {
|
||||
@ -31,7 +31,7 @@ const envData: EnvData = {
|
||||
},
|
||||
|
||||
skipMigrations: false,
|
||||
vectorExtension: DatabaseExtension.VECTORS,
|
||||
vectorExtension: DatabaseExtension.Vectors,
|
||||
},
|
||||
|
||||
licensePublicKey: {
|
||||
@ -84,7 +84,7 @@ const envData: EnvData = {
|
||||
metrics: new Set(),
|
||||
},
|
||||
|
||||
workers: [ImmichWorker.API, ImmichWorker.MICROSERVICES],
|
||||
workers: [ImmichWorker.Api, ImmichWorker.Microservices],
|
||||
|
||||
noColor: false,
|
||||
};
|
||||
@ -93,7 +93,7 @@ export const mockEnvData = (config: Partial<EnvData>) => ({ ...envData, ...confi
|
||||
export const newConfigRepositoryMock = (): Mocked<RepositoryInterface<ConfigRepository>> => {
|
||||
return {
|
||||
getEnv: vitest.fn().mockReturnValue(mockEnvData({})),
|
||||
getWorker: vitest.fn().mockReturnValue(ImmichWorker.API),
|
||||
getWorker: vitest.fn().mockReturnValue(ImmichWorker.Api),
|
||||
isDev: vitest.fn().mockReturnValue(false),
|
||||
};
|
||||
};
|
||||
|
@ -88,7 +88,7 @@ const authSharedLinkFactory = (sharedLink: Partial<AuthSharedLink> = {}) => {
|
||||
|
||||
const authApiKeyFactory = (apiKey: Partial<AuthApiKey> = {}) => ({
|
||||
id: newUuid(),
|
||||
permissions: [Permission.ALL],
|
||||
permissions: [Permission.All],
|
||||
...apiKey,
|
||||
});
|
||||
|
||||
@ -154,7 +154,7 @@ const userFactory = (user: Partial<User> = {}) => ({
|
||||
profileChangedAt: newDate(),
|
||||
metadata: [
|
||||
{
|
||||
key: UserMetadataKey.ONBOARDING,
|
||||
key: UserMetadataKey.Onboarding,
|
||||
value: 'true',
|
||||
},
|
||||
] as UserMetadataItem[],
|
||||
@ -178,7 +178,7 @@ const userAdminFactory = (user: Partial<UserAdmin> = {}) => {
|
||||
oauthId = '',
|
||||
quotaSizeInBytes = null,
|
||||
quotaUsageInBytes = 0,
|
||||
status = UserStatus.ACTIVE,
|
||||
status = UserStatus.Active,
|
||||
metadata = [],
|
||||
} = user;
|
||||
return {
|
||||
@ -208,7 +208,7 @@ const assetFactory = (asset: Partial<MapAsset> = {}) => ({
|
||||
updatedAt: newDate(),
|
||||
deletedAt: null,
|
||||
updateId: newUuidV7(),
|
||||
status: AssetStatus.ACTIVE,
|
||||
status: AssetStatus.Active,
|
||||
checksum: newSha1(),
|
||||
deviceAssetId: '',
|
||||
deviceId: '',
|
||||
@ -229,8 +229,8 @@ const assetFactory = (asset: Partial<MapAsset> = {}) => ({
|
||||
sidecarPath: null,
|
||||
stackId: null,
|
||||
thumbhash: null,
|
||||
type: AssetType.IMAGE,
|
||||
visibility: AssetVisibility.TIMELINE,
|
||||
type: AssetType.Image,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
...asset,
|
||||
});
|
||||
|
||||
@ -258,7 +258,7 @@ const apiKeyFactory = (apiKey: Partial<ApiKey> = {}) => ({
|
||||
updatedAt: newDate(),
|
||||
updateId: newUuidV7(),
|
||||
name: 'Api Key',
|
||||
permissions: [Permission.ALL],
|
||||
permissions: [Permission.All],
|
||||
...apiKey,
|
||||
});
|
||||
|
||||
@ -284,7 +284,7 @@ const memoryFactory = (memory: Partial<Memory> = {}) => ({
|
||||
updateId: newUuidV7(),
|
||||
deletedAt: null,
|
||||
ownerId: newUuid(),
|
||||
type: MemoryType.ON_THIS_DAY,
|
||||
type: MemoryType.OnThisDay,
|
||||
data: { year: 2024 } as OnThisDayData,
|
||||
isSaved: false,
|
||||
memoryAt: newDate(),
|
||||
|
Reference in New Issue
Block a user