2023-01-27 22:50:07 +02:00
|
|
|
import {
|
2023-03-03 04:47:08 +02:00
|
|
|
AlbumEntity,
|
2023-01-31 20:11:49 +02:00
|
|
|
APIKeyEntity,
|
2023-02-18 22:58:55 +02:00
|
|
|
AssetEntity,
|
2023-01-27 22:50:07 +02:00
|
|
|
AssetType,
|
|
|
|
SharedLinkEntity,
|
|
|
|
SharedLinkType,
|
|
|
|
SystemConfig,
|
2023-03-28 21:03:43 +02:00
|
|
|
TranscodePreset,
|
2023-01-27 22:50:07 +02:00
|
|
|
UserEntity,
|
|
|
|
UserTokenEntity,
|
2023-03-30 21:38:55 +02:00
|
|
|
} from '@app/infra/entities';
|
2023-02-07 04:47:06 +02:00
|
|
|
import {
|
|
|
|
AlbumResponseDto,
|
|
|
|
AssetResponseDto,
|
|
|
|
AuthUserDto,
|
|
|
|
ExifResponseDto,
|
|
|
|
mapUser,
|
2023-03-18 15:44:42 +02:00
|
|
|
SearchResult,
|
2023-02-07 04:47:06 +02:00
|
|
|
SharedLinkResponseDto,
|
|
|
|
} from '../src';
|
2023-01-25 18:35:28 +02:00
|
|
|
|
|
|
|
const today = new Date();
|
|
|
|
const tomorrow = new Date();
|
|
|
|
const yesterday = new Date();
|
|
|
|
tomorrow.setDate(today.getDate() + 1);
|
|
|
|
yesterday.setDate(yesterday.getDate() - 1);
|
|
|
|
|
2023-01-18 16:40:15 +02:00
|
|
|
export const authStub = {
|
|
|
|
admin: Object.freeze<AuthUserDto>({
|
|
|
|
id: 'admin_id',
|
|
|
|
email: 'admin@test.com',
|
|
|
|
isAdmin: true,
|
|
|
|
isPublicUser: false,
|
|
|
|
isAllowUpload: true,
|
|
|
|
}),
|
|
|
|
user1: Object.freeze<AuthUserDto>({
|
|
|
|
id: 'immich_id',
|
|
|
|
email: 'immich@test.com',
|
|
|
|
isAdmin: false,
|
|
|
|
isPublicUser: false,
|
|
|
|
isAllowUpload: true,
|
2023-01-27 22:50:07 +02:00
|
|
|
isAllowDownload: true,
|
|
|
|
isShowExif: true,
|
2023-02-06 07:31:16 +02:00
|
|
|
accessTokenId: 'token-id',
|
2023-01-18 16:40:15 +02:00
|
|
|
}),
|
2023-01-25 18:35:28 +02:00
|
|
|
adminSharedLink: Object.freeze<AuthUserDto>({
|
|
|
|
id: 'admin_id',
|
|
|
|
email: 'admin@test.com',
|
|
|
|
isAdmin: true,
|
|
|
|
isAllowUpload: true,
|
|
|
|
isAllowDownload: true,
|
|
|
|
isPublicUser: true,
|
|
|
|
isShowExif: true,
|
|
|
|
sharedLinkId: '123',
|
|
|
|
}),
|
|
|
|
readonlySharedLink: Object.freeze<AuthUserDto>({
|
|
|
|
id: 'admin_id',
|
|
|
|
email: 'admin@test.com',
|
|
|
|
isAdmin: true,
|
|
|
|
isAllowUpload: false,
|
|
|
|
isAllowDownload: false,
|
|
|
|
isPublicUser: true,
|
|
|
|
isShowExif: true,
|
|
|
|
sharedLinkId: '123',
|
2023-02-06 07:31:16 +02:00
|
|
|
accessTokenId: 'token-id',
|
2023-01-25 18:35:28 +02:00
|
|
|
}),
|
2023-01-18 16:40:15 +02:00
|
|
|
};
|
|
|
|
|
2023-01-27 22:50:07 +02:00
|
|
|
export const userEntityStub = {
|
2023-01-18 16:40:15 +02:00
|
|
|
admin: Object.freeze<UserEntity>({
|
|
|
|
...authStub.admin,
|
|
|
|
password: 'admin_password',
|
|
|
|
firstName: 'admin_first_name',
|
|
|
|
lastName: 'admin_last_name',
|
|
|
|
oauthId: '',
|
|
|
|
shouldChangePassword: false,
|
|
|
|
profileImagePath: '',
|
|
|
|
createdAt: '2021-01-01',
|
2023-02-06 18:24:58 +02:00
|
|
|
updatedAt: '2021-01-01',
|
2023-01-18 16:40:15 +02:00
|
|
|
tags: [],
|
2023-02-26 21:57:34 +02:00
|
|
|
assets: [],
|
2023-01-18 16:40:15 +02:00
|
|
|
}),
|
|
|
|
user1: Object.freeze<UserEntity>({
|
|
|
|
...authStub.user1,
|
|
|
|
password: 'immich_password',
|
|
|
|
firstName: 'immich_first_name',
|
|
|
|
lastName: 'immich_last_name',
|
|
|
|
oauthId: '',
|
|
|
|
shouldChangePassword: false,
|
|
|
|
profileImagePath: '',
|
|
|
|
createdAt: '2021-01-01',
|
2023-02-06 18:24:58 +02:00
|
|
|
updatedAt: '2021-01-01',
|
2023-01-18 16:40:15 +02:00
|
|
|
tags: [],
|
2023-02-26 21:57:34 +02:00
|
|
|
assets: [],
|
2023-01-18 16:40:15 +02:00
|
|
|
}),
|
|
|
|
};
|
2023-01-21 18:11:55 +02:00
|
|
|
|
2023-02-25 16:12:03 +02:00
|
|
|
export const fileStub = {
|
|
|
|
livePhotoStill: Object.freeze({
|
|
|
|
originalPath: 'fake_path/asset_1.jpeg',
|
|
|
|
mimeType: 'image/jpg',
|
|
|
|
checksum: Buffer.from('file hash', 'utf8'),
|
|
|
|
originalName: 'asset_1.jpeg',
|
|
|
|
}),
|
|
|
|
livePhotoMotion: Object.freeze({
|
|
|
|
originalPath: 'fake_path/asset_1.mp4',
|
|
|
|
mimeType: 'image/jpeg',
|
|
|
|
checksum: Buffer.from('live photo file hash', 'utf8'),
|
|
|
|
originalName: 'asset_1.mp4',
|
|
|
|
}),
|
|
|
|
};
|
|
|
|
|
2023-02-18 22:58:55 +02:00
|
|
|
export const assetEntityStub = {
|
2023-03-24 04:40:46 +02:00
|
|
|
noResizePath: Object.freeze<AssetEntity>({
|
2023-02-18 22:58:55 +02:00
|
|
|
id: 'asset-id',
|
|
|
|
deviceAssetId: 'device-asset-id',
|
2023-02-25 16:12:03 +02:00
|
|
|
fileModifiedAt: '2023-02-23T05:06:29.716Z',
|
|
|
|
fileCreatedAt: '2023-02-23T05:06:29.716Z',
|
2023-02-19 18:44:53 +02:00
|
|
|
owner: userEntityStub.user1,
|
|
|
|
ownerId: 'user-id',
|
2023-02-18 22:58:55 +02:00
|
|
|
deviceId: 'device-id',
|
2023-03-25 16:50:57 +02:00
|
|
|
originalPath: 'upload/upload/path.ext',
|
2023-02-18 22:58:55 +02:00
|
|
|
resizePath: null,
|
|
|
|
type: AssetType.IMAGE,
|
|
|
|
webpPath: null,
|
|
|
|
encodedVideoPath: null,
|
2023-02-25 16:12:03 +02:00
|
|
|
createdAt: '2023-02-23T05:06:29.716Z',
|
|
|
|
updatedAt: '2023-02-23T05:06:29.716Z',
|
2023-02-18 22:58:55 +02:00
|
|
|
mimeType: null,
|
|
|
|
isFavorite: true,
|
|
|
|
duration: null,
|
|
|
|
isVisible: true,
|
2023-02-19 18:44:53 +02:00
|
|
|
livePhotoVideo: null,
|
2023-02-18 22:58:55 +02:00
|
|
|
livePhotoVideoId: null,
|
|
|
|
tags: [],
|
2023-03-24 04:40:46 +02:00
|
|
|
sharedLinks: [],
|
|
|
|
}),
|
|
|
|
image: Object.freeze<AssetEntity>({
|
|
|
|
id: 'asset-id',
|
|
|
|
deviceAssetId: 'device-asset-id',
|
|
|
|
fileModifiedAt: '2023-02-23T05:06:29.716Z',
|
|
|
|
fileCreatedAt: '2023-02-23T05:06:29.716Z',
|
|
|
|
owner: userEntityStub.user1,
|
|
|
|
ownerId: 'user-id',
|
|
|
|
deviceId: 'device-id',
|
|
|
|
originalPath: '/original/path.ext',
|
|
|
|
resizePath: '/uploads/user-id/thumbs/path.ext',
|
|
|
|
type: AssetType.IMAGE,
|
|
|
|
webpPath: null,
|
|
|
|
encodedVideoPath: null,
|
|
|
|
createdAt: '2023-02-23T05:06:29.716Z',
|
|
|
|
updatedAt: '2023-02-23T05:06:29.716Z',
|
|
|
|
mimeType: null,
|
|
|
|
isFavorite: true,
|
|
|
|
duration: null,
|
|
|
|
isVisible: true,
|
|
|
|
livePhotoVideo: null,
|
|
|
|
livePhotoVideoId: null,
|
|
|
|
tags: [],
|
|
|
|
sharedLinks: [],
|
|
|
|
}),
|
|
|
|
video: Object.freeze<AssetEntity>({
|
|
|
|
id: 'asset-id',
|
|
|
|
deviceAssetId: 'device-asset-id',
|
|
|
|
fileModifiedAt: '2023-02-23T05:06:29.716Z',
|
|
|
|
fileCreatedAt: '2023-02-23T05:06:29.716Z',
|
|
|
|
owner: userEntityStub.user1,
|
|
|
|
ownerId: 'user-id',
|
|
|
|
deviceId: 'device-id',
|
|
|
|
originalPath: '/original/path.ext',
|
|
|
|
resizePath: '/uploads/user-id/thumbs/path.ext',
|
|
|
|
type: AssetType.VIDEO,
|
|
|
|
webpPath: null,
|
|
|
|
encodedVideoPath: null,
|
|
|
|
createdAt: '2023-02-23T05:06:29.716Z',
|
|
|
|
updatedAt: '2023-02-23T05:06:29.716Z',
|
|
|
|
mimeType: null,
|
|
|
|
isFavorite: true,
|
|
|
|
duration: null,
|
|
|
|
isVisible: true,
|
|
|
|
livePhotoVideo: null,
|
|
|
|
livePhotoVideoId: null,
|
|
|
|
tags: [],
|
2023-02-18 22:58:55 +02:00
|
|
|
sharedLinks: [],
|
|
|
|
}),
|
2023-02-25 16:12:03 +02:00
|
|
|
livePhotoMotionAsset: Object.freeze({
|
|
|
|
id: 'live-photo-motion-asset',
|
|
|
|
originalPath: fileStub.livePhotoMotion.originalPath,
|
|
|
|
ownerId: authStub.user1.id,
|
|
|
|
type: AssetType.VIDEO,
|
|
|
|
isVisible: false,
|
|
|
|
fileModifiedAt: '2022-06-19T23:41:36.910Z',
|
|
|
|
fileCreatedAt: '2022-06-19T23:41:36.910Z',
|
|
|
|
} as AssetEntity),
|
|
|
|
|
|
|
|
livePhotoStillAsset: Object.freeze({
|
|
|
|
id: 'live-photo-still-asset',
|
|
|
|
originalPath: fileStub.livePhotoStill.originalPath,
|
|
|
|
ownerId: authStub.user1.id,
|
|
|
|
type: AssetType.IMAGE,
|
|
|
|
livePhotoVideoId: 'live-photo-motion-asset',
|
|
|
|
isVisible: true,
|
|
|
|
fileModifiedAt: '2022-06-19T23:41:36.910Z',
|
|
|
|
fileCreatedAt: '2022-06-19T23:41:36.910Z',
|
|
|
|
} as AssetEntity),
|
2023-02-18 22:58:55 +02:00
|
|
|
};
|
|
|
|
|
2023-03-03 04:47:08 +02:00
|
|
|
export const albumStub = {
|
|
|
|
empty: Object.freeze<AlbumEntity>({
|
|
|
|
id: 'album-1',
|
|
|
|
albumName: 'Empty album',
|
|
|
|
ownerId: authStub.admin.id,
|
|
|
|
owner: userEntityStub.admin,
|
|
|
|
assets: [],
|
2023-03-04 16:16:48 +02:00
|
|
|
albumThumbnailAsset: null,
|
2023-03-03 04:47:08 +02:00
|
|
|
albumThumbnailAssetId: null,
|
|
|
|
createdAt: new Date().toISOString(),
|
2023-03-26 04:46:48 +02:00
|
|
|
updatedAt: new Date().toISOString(),
|
|
|
|
sharedLinks: [],
|
|
|
|
sharedUsers: [],
|
|
|
|
}),
|
|
|
|
sharedWithUser: Object.freeze<AlbumEntity>({
|
|
|
|
id: 'album-2',
|
|
|
|
albumName: 'Empty album shared with user',
|
|
|
|
ownerId: authStub.admin.id,
|
|
|
|
owner: userEntityStub.admin,
|
|
|
|
assets: [],
|
|
|
|
albumThumbnailAsset: null,
|
|
|
|
albumThumbnailAssetId: null,
|
|
|
|
createdAt: new Date().toISOString(),
|
|
|
|
updatedAt: new Date().toISOString(),
|
|
|
|
sharedLinks: [],
|
|
|
|
sharedUsers: [userEntityStub.user1],
|
|
|
|
}),
|
|
|
|
sharedWithAdmin: Object.freeze<AlbumEntity>({
|
|
|
|
id: 'album-3',
|
|
|
|
albumName: 'Empty album shared with admin',
|
|
|
|
ownerId: authStub.user1.id,
|
|
|
|
owner: userEntityStub.user1,
|
|
|
|
assets: [],
|
|
|
|
albumThumbnailAsset: null,
|
|
|
|
albumThumbnailAssetId: null,
|
|
|
|
createdAt: new Date().toISOString(),
|
|
|
|
updatedAt: new Date().toISOString(),
|
|
|
|
sharedLinks: [],
|
|
|
|
sharedUsers: [userEntityStub.admin],
|
|
|
|
}),
|
|
|
|
oneAsset: Object.freeze<AlbumEntity>({
|
|
|
|
id: 'album-4',
|
|
|
|
albumName: 'Album with one asset',
|
|
|
|
ownerId: authStub.admin.id,
|
|
|
|
owner: userEntityStub.admin,
|
|
|
|
assets: [assetEntityStub.image],
|
|
|
|
albumThumbnailAsset: null,
|
|
|
|
albumThumbnailAssetId: null,
|
|
|
|
createdAt: new Date().toISOString(),
|
|
|
|
updatedAt: new Date().toISOString(),
|
|
|
|
sharedLinks: [],
|
|
|
|
sharedUsers: [],
|
|
|
|
}),
|
|
|
|
emptyWithInvalidThumbnail: Object.freeze<AlbumEntity>({
|
|
|
|
id: 'album-5',
|
|
|
|
albumName: 'Empty album with invalid thumbnail',
|
|
|
|
ownerId: authStub.admin.id,
|
|
|
|
owner: userEntityStub.admin,
|
|
|
|
assets: [],
|
|
|
|
albumThumbnailAsset: assetEntityStub.image,
|
|
|
|
albumThumbnailAssetId: assetEntityStub.image.id,
|
|
|
|
createdAt: new Date().toISOString(),
|
|
|
|
updatedAt: new Date().toISOString(),
|
|
|
|
sharedLinks: [],
|
|
|
|
sharedUsers: [],
|
|
|
|
}),
|
|
|
|
emptyWithValidThumbnail: Object.freeze<AlbumEntity>({
|
|
|
|
id: 'album-5',
|
|
|
|
albumName: 'Empty album with invalid thumbnail',
|
|
|
|
ownerId: authStub.admin.id,
|
|
|
|
owner: userEntityStub.admin,
|
|
|
|
assets: [],
|
|
|
|
albumThumbnailAsset: null,
|
|
|
|
albumThumbnailAssetId: null,
|
|
|
|
createdAt: new Date().toISOString(),
|
|
|
|
updatedAt: new Date().toISOString(),
|
|
|
|
sharedLinks: [],
|
|
|
|
sharedUsers: [],
|
|
|
|
}),
|
|
|
|
oneAssetInvalidThumbnail: Object.freeze<AlbumEntity>({
|
|
|
|
id: 'album-6',
|
|
|
|
albumName: 'Album with one asset and invalid thumbnail',
|
|
|
|
ownerId: authStub.admin.id,
|
|
|
|
owner: userEntityStub.admin,
|
|
|
|
assets: [assetEntityStub.image],
|
|
|
|
albumThumbnailAsset: assetEntityStub.livePhotoMotionAsset,
|
|
|
|
albumThumbnailAssetId: assetEntityStub.livePhotoMotionAsset.id,
|
|
|
|
createdAt: new Date().toISOString(),
|
|
|
|
updatedAt: new Date().toISOString(),
|
|
|
|
sharedLinks: [],
|
|
|
|
sharedUsers: [],
|
|
|
|
}),
|
|
|
|
oneAssetValidThumbnail: Object.freeze<AlbumEntity>({
|
|
|
|
id: 'album-6',
|
|
|
|
albumName: 'Album with one asset and invalid thumbnail',
|
|
|
|
ownerId: authStub.admin.id,
|
|
|
|
owner: userEntityStub.admin,
|
|
|
|
assets: [assetEntityStub.image],
|
|
|
|
albumThumbnailAsset: assetEntityStub.image,
|
|
|
|
albumThumbnailAssetId: assetEntityStub.image.id,
|
|
|
|
createdAt: new Date().toISOString(),
|
2023-03-03 04:47:08 +02:00
|
|
|
updatedAt: new Date().toISOString(),
|
|
|
|
sharedLinks: [],
|
|
|
|
sharedUsers: [],
|
|
|
|
}),
|
|
|
|
};
|
|
|
|
|
2023-02-07 04:47:06 +02:00
|
|
|
const assetInfo: ExifResponseDto = {
|
|
|
|
make: 'camera-make',
|
|
|
|
model: 'camera-model',
|
|
|
|
imageName: 'fancy-image',
|
|
|
|
exifImageWidth: 500,
|
|
|
|
exifImageHeight: 500,
|
|
|
|
fileSizeInByte: 100,
|
|
|
|
orientation: 'orientation',
|
|
|
|
dateTimeOriginal: today,
|
|
|
|
modifyDate: today,
|
|
|
|
lensModel: 'fancy',
|
|
|
|
fNumber: 100,
|
|
|
|
focalLength: 100,
|
|
|
|
iso: 100,
|
|
|
|
exposureTime: '1/16',
|
|
|
|
latitude: 100,
|
|
|
|
longitude: 100,
|
|
|
|
city: 'city',
|
|
|
|
state: 'state',
|
|
|
|
country: 'country',
|
|
|
|
};
|
|
|
|
|
|
|
|
const assetResponse: AssetResponseDto = {
|
|
|
|
id: 'id_1',
|
|
|
|
deviceAssetId: 'device_asset_id_1',
|
|
|
|
ownerId: 'user_id_1',
|
|
|
|
deviceId: 'device_id_1',
|
|
|
|
type: AssetType.VIDEO,
|
|
|
|
originalPath: 'fake_path/jpeg',
|
|
|
|
resizePath: '',
|
2023-02-19 18:44:53 +02:00
|
|
|
fileModifiedAt: today.toISOString(),
|
|
|
|
fileCreatedAt: today.toISOString(),
|
2023-02-07 04:47:06 +02:00
|
|
|
updatedAt: today.toISOString(),
|
|
|
|
isFavorite: false,
|
|
|
|
mimeType: 'image/jpeg',
|
|
|
|
smartInfo: {
|
|
|
|
tags: [],
|
|
|
|
objects: ['a', 'b', 'c'],
|
|
|
|
},
|
|
|
|
webpPath: '',
|
|
|
|
encodedVideoPath: '',
|
|
|
|
duration: '0:00:00.00000',
|
|
|
|
exifInfo: assetInfo,
|
|
|
|
livePhotoVideoId: null,
|
|
|
|
tags: [],
|
|
|
|
};
|
|
|
|
|
|
|
|
const albumResponse: AlbumResponseDto = {
|
|
|
|
albumName: 'Test Album',
|
|
|
|
albumThumbnailAssetId: null,
|
|
|
|
createdAt: today.toISOString(),
|
|
|
|
updatedAt: today.toISOString(),
|
|
|
|
id: 'album-123',
|
|
|
|
ownerId: 'admin_id',
|
|
|
|
owner: mapUser(userEntityStub.admin),
|
|
|
|
sharedUsers: [],
|
|
|
|
shared: false,
|
|
|
|
assets: [],
|
|
|
|
assetCount: 1,
|
|
|
|
};
|
|
|
|
|
2023-01-27 22:50:07 +02:00
|
|
|
export const userTokenEntityStub = {
|
|
|
|
userToken: Object.freeze<UserTokenEntity>({
|
|
|
|
id: 'token-id',
|
|
|
|
token: 'auth_token',
|
|
|
|
user: userEntityStub.user1,
|
|
|
|
createdAt: '2021-01-01',
|
|
|
|
updatedAt: '2021-01-01',
|
|
|
|
}),
|
|
|
|
};
|
|
|
|
|
2023-01-31 20:11:49 +02:00
|
|
|
export const keyStub = {
|
|
|
|
admin: Object.freeze({
|
2023-02-18 22:58:55 +02:00
|
|
|
id: 'my-random-guid',
|
2023-01-31 20:11:49 +02:00
|
|
|
name: 'My Key',
|
|
|
|
key: 'my-api-key (hashed)',
|
|
|
|
userId: authStub.admin.id,
|
|
|
|
user: userEntityStub.admin,
|
|
|
|
} as APIKeyEntity),
|
|
|
|
};
|
|
|
|
|
2023-01-21 18:11:55 +02:00
|
|
|
export const systemConfigStub = {
|
|
|
|
defaults: Object.freeze({
|
|
|
|
ffmpeg: {
|
|
|
|
crf: '23',
|
|
|
|
preset: 'ultrafast',
|
2023-01-22 04:09:02 +02:00
|
|
|
targetAudioCodec: 'aac',
|
2023-01-21 18:11:55 +02:00
|
|
|
targetScaling: '1280:-2',
|
2023-01-22 04:09:02 +02:00
|
|
|
targetVideoCodec: 'h264',
|
2023-03-28 21:03:43 +02:00
|
|
|
transcode: TranscodePreset.REQUIRED,
|
2023-01-21 18:11:55 +02:00
|
|
|
},
|
|
|
|
oauth: {
|
|
|
|
autoLaunch: false,
|
|
|
|
autoRegister: true,
|
|
|
|
buttonText: 'Login with OAuth',
|
|
|
|
clientId: '',
|
|
|
|
clientSecret: '',
|
|
|
|
enabled: false,
|
|
|
|
issuerUrl: '',
|
|
|
|
mobileOverrideEnabled: false,
|
|
|
|
mobileRedirectUri: '',
|
|
|
|
scope: 'openid email profile',
|
|
|
|
},
|
|
|
|
passwordLogin: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
storageTemplate: {
|
|
|
|
template: '{{y}}/{{y}}-{{MM}}-{{dd}}/{{filename}}',
|
|
|
|
},
|
|
|
|
} as SystemConfig),
|
2023-01-24 06:13:42 +02:00
|
|
|
enabled: Object.freeze({
|
|
|
|
passwordLogin: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
oauth: {
|
|
|
|
enabled: true,
|
|
|
|
autoRegister: true,
|
|
|
|
buttonText: 'OAuth',
|
|
|
|
autoLaunch: false,
|
|
|
|
},
|
|
|
|
} as SystemConfig),
|
|
|
|
disabled: Object.freeze({
|
|
|
|
passwordLogin: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
|
|
|
oauth: {
|
|
|
|
enabled: false,
|
|
|
|
buttonText: 'OAuth',
|
|
|
|
issuerUrl: 'http://issuer,',
|
|
|
|
autoLaunch: false,
|
|
|
|
},
|
|
|
|
} as SystemConfig),
|
|
|
|
noAutoRegister: {
|
|
|
|
oauth: {
|
|
|
|
enabled: true,
|
|
|
|
autoRegister: false,
|
|
|
|
autoLaunch: false,
|
|
|
|
},
|
|
|
|
passwordLogin: { enabled: true },
|
|
|
|
} as SystemConfig,
|
|
|
|
override: {
|
|
|
|
oauth: {
|
|
|
|
enabled: true,
|
|
|
|
autoRegister: true,
|
|
|
|
autoLaunch: false,
|
|
|
|
buttonText: 'OAuth',
|
|
|
|
mobileOverrideEnabled: true,
|
|
|
|
mobileRedirectUri: 'http://mobile-redirect',
|
|
|
|
},
|
|
|
|
passwordLogin: { enabled: true },
|
|
|
|
} as SystemConfig,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const loginResponseStub = {
|
|
|
|
user1oauth: {
|
|
|
|
response: {
|
2023-01-27 22:50:07 +02:00
|
|
|
accessToken: 'cmFuZG9tLWJ5dGVz',
|
2023-01-24 06:13:42 +02:00
|
|
|
userId: 'immich_id',
|
|
|
|
userEmail: 'immich@test.com',
|
|
|
|
firstName: 'immich_first_name',
|
|
|
|
lastName: 'immich_last_name',
|
|
|
|
profileImagePath: '',
|
|
|
|
isAdmin: false,
|
|
|
|
shouldChangePassword: false,
|
|
|
|
},
|
|
|
|
cookie: [
|
2023-03-08 18:26:49 +02:00
|
|
|
'immich_access_token=cmFuZG9tLWJ5dGVz; HttpOnly; Secure; Path=/; Max-Age=34560000; SameSite=Lax;',
|
|
|
|
'immich_auth_type=oauth; HttpOnly; Secure; Path=/; Max-Age=34560000; SameSite=Lax;',
|
2023-01-24 06:13:42 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
user1password: {
|
|
|
|
response: {
|
2023-01-27 22:50:07 +02:00
|
|
|
accessToken: 'cmFuZG9tLWJ5dGVz',
|
2023-01-24 06:13:42 +02:00
|
|
|
userId: 'immich_id',
|
|
|
|
userEmail: 'immich@test.com',
|
|
|
|
firstName: 'immich_first_name',
|
|
|
|
lastName: 'immich_last_name',
|
|
|
|
profileImagePath: '',
|
|
|
|
isAdmin: false,
|
|
|
|
shouldChangePassword: false,
|
|
|
|
},
|
|
|
|
cookie: [
|
2023-03-08 18:26:49 +02:00
|
|
|
'immich_access_token=cmFuZG9tLWJ5dGVz; HttpOnly; Secure; Path=/; Max-Age=34560000; SameSite=Lax;',
|
|
|
|
'immich_auth_type=password; HttpOnly; Secure; Path=/; Max-Age=34560000; SameSite=Lax;',
|
2023-01-24 06:13:42 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
user1insecure: {
|
|
|
|
response: {
|
2023-01-27 22:50:07 +02:00
|
|
|
accessToken: 'cmFuZG9tLWJ5dGVz',
|
2023-01-24 06:13:42 +02:00
|
|
|
userId: 'immich_id',
|
|
|
|
userEmail: 'immich@test.com',
|
|
|
|
firstName: 'immich_first_name',
|
|
|
|
lastName: 'immich_last_name',
|
|
|
|
profileImagePath: '',
|
|
|
|
isAdmin: false,
|
|
|
|
shouldChangePassword: false,
|
|
|
|
},
|
|
|
|
cookie: [
|
2023-03-08 18:26:49 +02:00
|
|
|
'immich_access_token=cmFuZG9tLWJ5dGVz; HttpOnly; Path=/; Max-Age=34560000; SameSite=Lax;',
|
|
|
|
'immich_auth_type=password; HttpOnly; Path=/; Max-Age=34560000; SameSite=Lax;',
|
2023-01-24 06:13:42 +02:00
|
|
|
],
|
|
|
|
},
|
2023-01-21 18:11:55 +02:00
|
|
|
};
|
2023-01-25 18:35:28 +02:00
|
|
|
|
|
|
|
export const sharedLinkStub = {
|
|
|
|
valid: Object.freeze({
|
|
|
|
id: '123',
|
|
|
|
userId: authStub.admin.id,
|
2023-01-31 20:11:49 +02:00
|
|
|
user: userEntityStub.admin,
|
2023-01-25 18:35:28 +02:00
|
|
|
key: Buffer.from('secret-key', 'utf8'),
|
|
|
|
type: SharedLinkType.ALBUM,
|
|
|
|
createdAt: today.toISOString(),
|
|
|
|
expiresAt: tomorrow.toISOString(),
|
|
|
|
allowUpload: true,
|
|
|
|
allowDownload: true,
|
|
|
|
showExif: true,
|
|
|
|
album: undefined,
|
|
|
|
assets: [],
|
|
|
|
} as SharedLinkEntity),
|
|
|
|
expired: Object.freeze({
|
|
|
|
id: '123',
|
|
|
|
userId: authStub.admin.id,
|
2023-01-31 20:11:49 +02:00
|
|
|
user: userEntityStub.admin,
|
2023-01-25 18:35:28 +02:00
|
|
|
key: Buffer.from('secret-key', 'utf8'),
|
|
|
|
type: SharedLinkType.ALBUM,
|
|
|
|
createdAt: today.toISOString(),
|
|
|
|
expiresAt: yesterday.toISOString(),
|
|
|
|
allowUpload: true,
|
|
|
|
allowDownload: true,
|
|
|
|
showExif: true,
|
|
|
|
assets: [],
|
|
|
|
} as SharedLinkEntity),
|
|
|
|
readonly: Object.freeze<SharedLinkEntity>({
|
|
|
|
id: '123',
|
|
|
|
userId: authStub.admin.id,
|
2023-01-31 20:11:49 +02:00
|
|
|
user: userEntityStub.admin,
|
2023-01-25 18:35:28 +02:00
|
|
|
key: Buffer.from('secret-key', 'utf8'),
|
|
|
|
type: SharedLinkType.ALBUM,
|
|
|
|
createdAt: today.toISOString(),
|
|
|
|
expiresAt: tomorrow.toISOString(),
|
|
|
|
allowUpload: false,
|
|
|
|
allowDownload: false,
|
|
|
|
showExif: true,
|
|
|
|
assets: [],
|
|
|
|
album: {
|
|
|
|
id: 'album-123',
|
|
|
|
ownerId: authStub.admin.id,
|
2023-02-07 04:47:06 +02:00
|
|
|
owner: userEntityStub.admin,
|
2023-01-25 18:35:28 +02:00
|
|
|
albumName: 'Test Album',
|
|
|
|
createdAt: today.toISOString(),
|
2023-02-06 18:24:58 +02:00
|
|
|
updatedAt: today.toISOString(),
|
2023-03-04 16:16:48 +02:00
|
|
|
albumThumbnailAsset: null,
|
2023-01-25 18:35:28 +02:00
|
|
|
albumThumbnailAssetId: null,
|
|
|
|
sharedUsers: [],
|
|
|
|
sharedLinks: [],
|
|
|
|
assets: [
|
|
|
|
{
|
2023-02-18 22:58:55 +02:00
|
|
|
id: 'id_1',
|
2023-02-19 18:44:53 +02:00
|
|
|
owner: userEntityStub.user1,
|
|
|
|
ownerId: 'user_id_1',
|
2023-02-18 22:58:55 +02:00
|
|
|
deviceAssetId: 'device_asset_id_1',
|
|
|
|
deviceId: 'device_id_1',
|
|
|
|
type: AssetType.VIDEO,
|
|
|
|
originalPath: 'fake_path/jpeg',
|
|
|
|
resizePath: '',
|
2023-02-19 18:44:53 +02:00
|
|
|
fileModifiedAt: today.toISOString(),
|
|
|
|
fileCreatedAt: today.toISOString(),
|
2023-02-18 22:58:55 +02:00
|
|
|
createdAt: today.toISOString(),
|
|
|
|
updatedAt: today.toISOString(),
|
|
|
|
isFavorite: false,
|
|
|
|
mimeType: 'image/jpeg',
|
|
|
|
smartInfo: {
|
|
|
|
assetId: 'id_1',
|
2023-01-25 18:35:28 +02:00
|
|
|
tags: [],
|
2023-02-18 22:58:55 +02:00
|
|
|
objects: ['a', 'b', 'c'],
|
|
|
|
asset: null as any,
|
2023-03-18 15:44:42 +02:00
|
|
|
clipEmbedding: [0.12, 0.13, 0.14],
|
2023-02-18 22:58:55 +02:00
|
|
|
},
|
|
|
|
webpPath: '',
|
|
|
|
encodedVideoPath: '',
|
|
|
|
duration: null,
|
|
|
|
isVisible: true,
|
2023-02-19 18:44:53 +02:00
|
|
|
livePhotoVideo: null,
|
2023-02-18 22:58:55 +02:00
|
|
|
livePhotoVideoId: null,
|
|
|
|
exifInfo: {
|
|
|
|
livePhotoCID: null,
|
|
|
|
assetId: 'id_1',
|
|
|
|
description: 'description',
|
|
|
|
exifImageWidth: 500,
|
|
|
|
exifImageHeight: 500,
|
|
|
|
fileSizeInByte: 100,
|
|
|
|
orientation: 'orientation',
|
|
|
|
dateTimeOriginal: today,
|
|
|
|
modifyDate: today,
|
|
|
|
latitude: 100,
|
|
|
|
longitude: 100,
|
|
|
|
city: 'city',
|
|
|
|
state: 'state',
|
|
|
|
country: 'country',
|
|
|
|
make: 'camera-make',
|
|
|
|
model: 'camera-model',
|
|
|
|
imageName: 'fancy-image',
|
|
|
|
lensModel: 'fancy',
|
|
|
|
fNumber: 100,
|
|
|
|
focalLength: 100,
|
|
|
|
iso: 100,
|
|
|
|
exposureTime: '1/16',
|
|
|
|
fps: 100,
|
|
|
|
asset: null as any,
|
|
|
|
exifTextSearchableColumn: '',
|
2023-01-25 18:35:28 +02:00
|
|
|
},
|
2023-02-18 22:58:55 +02:00
|
|
|
tags: [],
|
|
|
|
sharedLinks: [],
|
2023-01-25 18:35:28 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
};
|
|
|
|
|
|
|
|
export const sharedLinkResponseStub = {
|
|
|
|
valid: Object.freeze<SharedLinkResponseDto>({
|
|
|
|
allowDownload: true,
|
|
|
|
allowUpload: true,
|
|
|
|
assets: [],
|
|
|
|
createdAt: today.toISOString(),
|
|
|
|
description: undefined,
|
|
|
|
expiresAt: tomorrow.toISOString(),
|
|
|
|
id: '123',
|
|
|
|
key: '7365637265742d6b6579',
|
|
|
|
showExif: true,
|
|
|
|
type: SharedLinkType.ALBUM,
|
|
|
|
userId: 'admin_id',
|
|
|
|
}),
|
|
|
|
expired: Object.freeze<SharedLinkResponseDto>({
|
|
|
|
album: undefined,
|
|
|
|
allowDownload: true,
|
|
|
|
allowUpload: true,
|
|
|
|
assets: [],
|
|
|
|
createdAt: today.toISOString(),
|
|
|
|
description: undefined,
|
|
|
|
expiresAt: yesterday.toISOString(),
|
|
|
|
id: '123',
|
|
|
|
key: '7365637265742d6b6579',
|
|
|
|
showExif: true,
|
|
|
|
type: SharedLinkType.ALBUM,
|
|
|
|
userId: 'admin_id',
|
|
|
|
}),
|
|
|
|
readonly: Object.freeze<SharedLinkResponseDto>({
|
|
|
|
id: '123',
|
|
|
|
userId: 'admin_id',
|
|
|
|
key: '7365637265742d6b6579',
|
|
|
|
type: SharedLinkType.ALBUM,
|
|
|
|
createdAt: today.toISOString(),
|
|
|
|
expiresAt: tomorrow.toISOString(),
|
|
|
|
description: undefined,
|
|
|
|
allowUpload: false,
|
|
|
|
allowDownload: false,
|
|
|
|
showExif: true,
|
|
|
|
album: albumResponse,
|
|
|
|
assets: [assetResponse],
|
|
|
|
}),
|
|
|
|
readonlyNoExif: Object.freeze<SharedLinkResponseDto>({
|
|
|
|
id: '123',
|
|
|
|
userId: 'admin_id',
|
|
|
|
key: '7365637265742d6b6579',
|
|
|
|
type: SharedLinkType.ALBUM,
|
|
|
|
createdAt: today.toISOString(),
|
|
|
|
expiresAt: tomorrow.toISOString(),
|
|
|
|
description: undefined,
|
|
|
|
allowUpload: false,
|
|
|
|
allowDownload: false,
|
|
|
|
showExif: true,
|
|
|
|
album: albumResponse,
|
|
|
|
assets: [{ ...assetResponse, exifInfo: undefined }],
|
|
|
|
}),
|
|
|
|
};
|
|
|
|
|
|
|
|
// TODO - the constructor isn't used anywhere, so not test coverage
|
|
|
|
new ExifResponseDto();
|
2023-03-18 15:44:42 +02:00
|
|
|
|
|
|
|
export const searchStub = {
|
|
|
|
emptyResults: Object.freeze<SearchResult<any>>({
|
|
|
|
total: 0,
|
|
|
|
count: 0,
|
|
|
|
page: 1,
|
|
|
|
items: [],
|
|
|
|
facets: [],
|
|
|
|
}),
|
|
|
|
};
|