mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
chore: remove asset stubs (#26187)
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { Selectable } from 'kysely';
|
||||
import { SourceType } from 'src/enum';
|
||||
import { AssetFaceTable } from 'src/schema/tables/asset-face.table';
|
||||
import { build } from 'test/factories/builder.factory';
|
||||
import { PersonFactory } from 'test/factories/person.factory';
|
||||
import { AssetFaceLike, FactoryBuilder, PersonLike } from 'test/factories/types';
|
||||
import { newDate, newUuid, newUuidV7 } from 'test/small.factory';
|
||||
|
||||
export class AssetFaceFactory {
|
||||
#person: PersonFactory | null = null;
|
||||
|
||||
private constructor(private readonly value: Selectable<AssetFaceTable>) {}
|
||||
|
||||
static create(dto: AssetFaceLike = {}) {
|
||||
return AssetFaceFactory.from(dto).build();
|
||||
}
|
||||
|
||||
static from(dto: AssetFaceLike = {}) {
|
||||
return new AssetFaceFactory({
|
||||
assetId: newUuid(),
|
||||
boundingBoxX1: 11,
|
||||
boundingBoxX2: 12,
|
||||
boundingBoxY1: 21,
|
||||
boundingBoxY2: 22,
|
||||
deletedAt: null,
|
||||
id: newUuid(),
|
||||
imageHeight: 42,
|
||||
imageWidth: 420,
|
||||
isVisible: true,
|
||||
personId: null,
|
||||
sourceType: SourceType.MachineLearning,
|
||||
updatedAt: newDate(),
|
||||
updateId: newUuidV7(),
|
||||
...dto,
|
||||
});
|
||||
}
|
||||
|
||||
person(dto: PersonLike = {}, builder?: FactoryBuilder<PersonFactory>) {
|
||||
this.#person = build(PersonFactory.from(dto), builder);
|
||||
this.value.personId = this.#person.build().id;
|
||||
return this;
|
||||
}
|
||||
|
||||
build() {
|
||||
return { ...this.value, person: this.#person?.build() ?? null };
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,23 @@
|
||||
import { Selectable } from 'kysely';
|
||||
import { AssetFileType, AssetStatus, AssetType, AssetVisibility } from 'src/enum';
|
||||
import { AssetFaceTable } from 'src/schema/tables/asset-face.table';
|
||||
import { AssetTable } from 'src/schema/tables/asset.table';
|
||||
import { StackTable } from 'src/schema/tables/stack.table';
|
||||
import { AssetEditFactory } from 'test/factories/asset-edit.factory';
|
||||
import { AssetExifFactory } from 'test/factories/asset-exif.factory';
|
||||
import { AssetFaceFactory } from 'test/factories/asset-face.factory';
|
||||
import { AssetFileFactory } from 'test/factories/asset-file.factory';
|
||||
import { build } from 'test/factories/builder.factory';
|
||||
import { AssetEditLike, AssetExifLike, AssetFileLike, AssetLike, FactoryBuilder, UserLike } from 'test/factories/types';
|
||||
import { StackFactory } from 'test/factories/stack.factory';
|
||||
import {
|
||||
AssetEditLike,
|
||||
AssetExifLike,
|
||||
AssetFaceLike,
|
||||
AssetFileLike,
|
||||
AssetLike,
|
||||
FactoryBuilder,
|
||||
StackLike,
|
||||
UserLike,
|
||||
} from 'test/factories/types';
|
||||
import { UserFactory } from 'test/factories/user.factory';
|
||||
import { newDate, newSha1, newUuid, newUuidV7 } from 'test/small.factory';
|
||||
|
||||
@@ -15,7 +26,8 @@ export class AssetFactory {
|
||||
#assetExif?: AssetExifFactory;
|
||||
#files: AssetFileFactory[] = [];
|
||||
#edits: AssetEditFactory[] = [];
|
||||
#faces: Selectable<AssetFaceTable>[] = [];
|
||||
#faces: AssetFaceFactory[] = [];
|
||||
#stack?: Selectable<StackTable> & { assets: Selectable<AssetTable>[]; primaryAsset: Selectable<AssetTable> };
|
||||
|
||||
private constructor(private readonly value: Selectable<AssetTable>) {
|
||||
value.ownerId ??= newUuid();
|
||||
@@ -83,8 +95,8 @@ export class AssetFactory {
|
||||
return this;
|
||||
}
|
||||
|
||||
face(dto: Selectable<AssetFaceTable>) {
|
||||
this.#faces.push(dto);
|
||||
face(dto: AssetFaceLike = {}, builder?: FactoryBuilder<AssetFaceFactory>) {
|
||||
this.#faces.push(build(AssetFaceFactory.from(dto), builder));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -117,6 +129,12 @@ export class AssetFactory {
|
||||
return this;
|
||||
}
|
||||
|
||||
stack(dto: StackLike = {}, builder?: FactoryBuilder<StackFactory>) {
|
||||
this.#stack = build(StackFactory.from(dto).primaryAsset(this.value), builder).build();
|
||||
this.value.stackId = this.#stack.id;
|
||||
return this;
|
||||
}
|
||||
|
||||
build() {
|
||||
const exif = this.#assetExif?.build();
|
||||
|
||||
@@ -126,8 +144,9 @@ export class AssetFactory {
|
||||
exifInfo: exif as NonNullable<typeof exif>,
|
||||
files: this.#files.map((file) => file.build()),
|
||||
edits: this.#edits.map((edit) => edit.build()),
|
||||
faces: this.#faces,
|
||||
stack: null,
|
||||
faces: this.#faces.map((face) => face.build()),
|
||||
stack: this.#stack ?? null,
|
||||
tags: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { Selectable } from 'kysely';
|
||||
import { PersonTable } from 'src/schema/tables/person.table';
|
||||
import { PersonLike } from 'test/factories/types';
|
||||
import { newDate, newUuid, newUuidV7 } from 'test/small.factory';
|
||||
|
||||
export class PersonFactory {
|
||||
private constructor(private readonly value: Selectable<PersonTable>) {}
|
||||
|
||||
static create(dto: PersonLike = {}) {
|
||||
return PersonFactory.from(dto).build();
|
||||
}
|
||||
|
||||
static from(dto: PersonLike = {}) {
|
||||
return new PersonFactory({
|
||||
birthDate: null,
|
||||
color: null,
|
||||
createdAt: newDate(),
|
||||
faceAssetId: null,
|
||||
id: newUuid(),
|
||||
isFavorite: false,
|
||||
isHidden: false,
|
||||
name: 'person',
|
||||
ownerId: newUuid(),
|
||||
thumbnailPath: '/data/thumbs/person-thumbnail.jpg',
|
||||
updatedAt: newDate(),
|
||||
updateId: newUuidV7(),
|
||||
...dto,
|
||||
});
|
||||
}
|
||||
|
||||
build() {
|
||||
return { ...this.value };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import { Selectable } from 'kysely';
|
||||
import { StackTable } from 'src/schema/tables/stack.table';
|
||||
import { AssetFactory } from 'test/factories/asset.factory';
|
||||
import { build } from 'test/factories/builder.factory';
|
||||
import { AssetLike, FactoryBuilder, StackLike } from 'test/factories/types';
|
||||
import { newDate, newUuid, newUuidV7 } from 'test/small.factory';
|
||||
|
||||
export class StackFactory {
|
||||
#assets: AssetFactory[] = [];
|
||||
#primaryAsset: AssetFactory;
|
||||
|
||||
private constructor(private readonly value: Selectable<StackTable>) {
|
||||
this.#primaryAsset = AssetFactory.from();
|
||||
this.value.primaryAssetId = this.#primaryAsset.build().id;
|
||||
}
|
||||
|
||||
static create(dto: StackLike = {}) {
|
||||
return StackFactory.from(dto).build();
|
||||
}
|
||||
|
||||
static from(dto: StackLike = {}) {
|
||||
return new StackFactory({
|
||||
createdAt: newDate(),
|
||||
id: newUuid(),
|
||||
ownerId: newUuid(),
|
||||
primaryAssetId: newUuid(),
|
||||
updatedAt: newDate(),
|
||||
updateId: newUuidV7(),
|
||||
...dto,
|
||||
});
|
||||
}
|
||||
|
||||
asset(dto: AssetLike = {}, builder?: FactoryBuilder<AssetFactory>) {
|
||||
this.#assets.push(build(AssetFactory.from(dto), builder));
|
||||
return this;
|
||||
}
|
||||
|
||||
primaryAsset(dto: AssetLike = {}, builder?: FactoryBuilder<AssetFactory>) {
|
||||
this.#primaryAsset = build(AssetFactory.from(dto), builder);
|
||||
this.value.primaryAssetId = this.#primaryAsset.build().id;
|
||||
this.#assets.push(this.#primaryAsset);
|
||||
return this;
|
||||
}
|
||||
|
||||
build() {
|
||||
return {
|
||||
...this.value,
|
||||
assets: this.#assets.map((asset) => asset.build()),
|
||||
primaryAsset: this.#primaryAsset.build(),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,12 @@ import { AlbumUserTable } from 'src/schema/tables/album-user.table';
|
||||
import { AlbumTable } from 'src/schema/tables/album.table';
|
||||
import { AssetEditTable } from 'src/schema/tables/asset-edit.table';
|
||||
import { AssetExifTable } from 'src/schema/tables/asset-exif.table';
|
||||
import { AssetFaceTable } from 'src/schema/tables/asset-face.table';
|
||||
import { AssetFileTable } from 'src/schema/tables/asset-file.table';
|
||||
import { AssetTable } from 'src/schema/tables/asset.table';
|
||||
import { PersonTable } from 'src/schema/tables/person.table';
|
||||
import { SharedLinkTable } from 'src/schema/tables/shared-link.table';
|
||||
import { StackTable } from 'src/schema/tables/stack.table';
|
||||
import { UserTable } from 'src/schema/tables/user.table';
|
||||
|
||||
export type FactoryBuilder<T, R extends T = T> = (builder: T) => R;
|
||||
@@ -18,3 +21,6 @@ export type AlbumLike = Partial<Selectable<AlbumTable>>;
|
||||
export type AlbumUserLike = Partial<Selectable<AlbumUserTable>>;
|
||||
export type SharedLinkLike = Partial<Selectable<SharedLinkTable>>;
|
||||
export type UserLike = Partial<Selectable<UserTable>>;
|
||||
export type AssetFaceLike = Partial<Selectable<AssetFaceTable>>;
|
||||
export type PersonLike = Partial<Selectable<PersonTable>>;
|
||||
export type StackLike = Partial<Selectable<StackTable>>;
|
||||
|
||||
Vendored
-298
@@ -1,298 +0,0 @@
|
||||
import { Exif } from 'src/database';
|
||||
import { MapAsset } from 'src/dtos/asset-response.dto';
|
||||
import { AssetEditAction, AssetEditActionItem } from 'src/dtos/editing.dto';
|
||||
import { AssetFileType, AssetStatus, AssetType, AssetVisibility } from 'src/enum';
|
||||
import { StorageAsset } from 'src/types';
|
||||
import { userStub } from 'test/fixtures/user.stub';
|
||||
import { factory } from 'test/small.factory';
|
||||
|
||||
export const previewFile = factory.assetFile({ type: AssetFileType.Preview });
|
||||
|
||||
const thumbnailFile = factory.assetFile({
|
||||
type: AssetFileType.Thumbnail,
|
||||
path: '/uploads/user-id/webp/path.ext',
|
||||
});
|
||||
|
||||
const fullsizeFile = factory.assetFile({
|
||||
type: AssetFileType.FullSize,
|
||||
path: '/uploads/user-id/fullsize/path.webp',
|
||||
});
|
||||
|
||||
const files = [fullsizeFile, previewFile, thumbnailFile];
|
||||
|
||||
export const stackStub = (stackId: string, assets: (MapAsset & { exifInfo: Exif })[]) => {
|
||||
return {
|
||||
id: stackId,
|
||||
assets,
|
||||
ownerId: assets[0].ownerId,
|
||||
primaryAsset: assets[0],
|
||||
primaryAssetId: assets[0].id,
|
||||
createdAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
updatedAt: new Date('2023-02-23T05:06:29.716Z'),
|
||||
updateId: expect.any(String),
|
||||
};
|
||||
};
|
||||
|
||||
export const assetStub = {
|
||||
storageAsset: (asset: Partial<StorageAsset> = {}) => ({
|
||||
id: 'asset-id',
|
||||
ownerId: 'user-id',
|
||||
livePhotoVideoId: null,
|
||||
type: AssetType.Image,
|
||||
isExternal: false,
|
||||
checksum: Buffer.from('file hash'),
|
||||
timeZone: null,
|
||||
fileCreatedAt: new Date('2022-06-19T23:41:36.910Z'),
|
||||
originalPath: '/original/path.jpg',
|
||||
originalFileName: 'IMG_123.jpg',
|
||||
fileSizeInByte: 12_345,
|
||||
files: [],
|
||||
make: 'FUJIFILM',
|
||||
model: 'X-T50',
|
||||
lensModel: 'XF27mm F2.8 R WR',
|
||||
isEdited: false,
|
||||
...asset,
|
||||
}),
|
||||
|
||||
primaryImage: Object.freeze({
|
||||
id: 'primary-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.admin,
|
||||
ownerId: 'admin-id',
|
||||
deviceId: 'device-id',
|
||||
originalPath: '/original/path.jpg',
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
files,
|
||||
type: AssetType.Image,
|
||||
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,
|
||||
duration: null,
|
||||
isExternal: false,
|
||||
livePhotoVideo: null,
|
||||
livePhotoVideoId: null,
|
||||
sharedLinks: [],
|
||||
originalFileName: 'asset-id.jpg',
|
||||
faces: [],
|
||||
deletedAt: null,
|
||||
exifInfo: {
|
||||
fileSizeInByte: 5000,
|
||||
exifImageHeight: 1000,
|
||||
exifImageWidth: 1000,
|
||||
} as Exif,
|
||||
stackId: 'stack-1',
|
||||
stack: stackStub('stack-1', [
|
||||
{ id: 'primary-asset-id' } as MapAsset & { exifInfo: Exif },
|
||||
{ id: 'stack-child-asset-1' } as MapAsset & { exifInfo: Exif },
|
||||
{ id: 'stack-child-asset-2' } as MapAsset & { exifInfo: Exif },
|
||||
]),
|
||||
duplicateId: null,
|
||||
isOffline: false,
|
||||
updateId: '42',
|
||||
libraryId: null,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
width: null,
|
||||
height: null,
|
||||
edits: [],
|
||||
isEdited: false,
|
||||
}),
|
||||
|
||||
withLocation: Object.freeze({
|
||||
id: 'asset-with-favorite-id',
|
||||
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'),
|
||||
owner: userStub.user1,
|
||||
ownerId: 'user-id',
|
||||
deviceId: 'device-id',
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
originalPath: '/original/path.ext',
|
||||
type: AssetType.Image,
|
||||
files: [previewFile],
|
||||
thumbhash: null,
|
||||
encodedVideoPath: null,
|
||||
createdAt: new Date('2023-02-22T05:06:29.716Z'),
|
||||
updatedAt: new Date('2023-02-22T05:06:29.716Z'),
|
||||
localDateTime: new Date('2020-12-31T23:59:00.000Z'),
|
||||
isFavorite: false,
|
||||
isExternal: false,
|
||||
duration: null,
|
||||
livePhotoVideo: null,
|
||||
livePhotoVideoId: null,
|
||||
updateId: 'foo',
|
||||
libraryId: null,
|
||||
stackId: null,
|
||||
sharedLinks: [],
|
||||
originalFileName: 'asset-id.ext',
|
||||
faces: [],
|
||||
exifInfo: {
|
||||
latitude: 100,
|
||||
longitude: 100,
|
||||
fileSizeInByte: 23_456,
|
||||
city: 'test-city',
|
||||
state: 'test-state',
|
||||
country: 'test-country',
|
||||
} as Exif,
|
||||
deletedAt: null,
|
||||
duplicateId: null,
|
||||
isOffline: false,
|
||||
tags: [],
|
||||
visibility: AssetVisibility.Timeline,
|
||||
width: null,
|
||||
height: null,
|
||||
edits: [],
|
||||
isEdited: false,
|
||||
}),
|
||||
|
||||
hasEncodedVideo: Object.freeze({
|
||||
id: 'asset-id',
|
||||
status: AssetStatus.Active,
|
||||
originalFileName: 'asset-id.ext',
|
||||
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: '/original/path.ext',
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.Video,
|
||||
files: [previewFile],
|
||||
thumbhash: null,
|
||||
encodedVideoPath: '/encoded/video/path.mp4',
|
||||
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,
|
||||
isExternal: false,
|
||||
duration: null,
|
||||
livePhotoVideo: null,
|
||||
livePhotoVideoId: null,
|
||||
sharedLinks: [],
|
||||
faces: [],
|
||||
exifInfo: {
|
||||
fileSizeInByte: 100_000,
|
||||
} as Exif,
|
||||
deletedAt: null,
|
||||
duplicateId: null,
|
||||
isOffline: false,
|
||||
updateId: '42',
|
||||
libraryId: null,
|
||||
stackId: null,
|
||||
stack: null,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
width: null,
|
||||
height: null,
|
||||
edits: [],
|
||||
isEdited: false,
|
||||
}),
|
||||
|
||||
imageDng: Object.freeze({
|
||||
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: '/original/path.dng',
|
||||
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,
|
||||
duration: null,
|
||||
isExternal: false,
|
||||
livePhotoVideo: null,
|
||||
livePhotoVideoId: null,
|
||||
sharedLinks: [],
|
||||
originalFileName: 'asset-id.dng',
|
||||
faces: [],
|
||||
deletedAt: null,
|
||||
exifInfo: {
|
||||
fileSizeInByte: 5000,
|
||||
profileDescription: 'Adobe RGB',
|
||||
bitsPerSample: 14,
|
||||
} as Exif,
|
||||
duplicateId: null,
|
||||
isOffline: false,
|
||||
updateId: '42',
|
||||
libraryId: null,
|
||||
stackId: null,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
width: null,
|
||||
height: null,
|
||||
edits: [],
|
||||
isEdited: false,
|
||||
}),
|
||||
|
||||
withCropEdit: Object.freeze({
|
||||
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: '/original/path.jpg',
|
||||
files,
|
||||
checksum: Buffer.from('file hash', 'utf8'),
|
||||
type: AssetType.Image,
|
||||
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('2025-01-01T01:02:03.456Z'),
|
||||
isFavorite: true,
|
||||
duration: null,
|
||||
isExternal: false,
|
||||
livePhotoVideo: null,
|
||||
livePhotoVideoId: null,
|
||||
updateId: 'foo',
|
||||
libraryId: null,
|
||||
stackId: null,
|
||||
sharedLinks: [],
|
||||
originalFileName: 'asset-id.jpg',
|
||||
faces: [],
|
||||
deletedAt: null,
|
||||
sidecarPath: null,
|
||||
exifInfo: {
|
||||
fileSizeInByte: 5000,
|
||||
exifImageHeight: 3840,
|
||||
exifImageWidth: 2160,
|
||||
} as Exif,
|
||||
duplicateId: null,
|
||||
isOffline: false,
|
||||
stack: null,
|
||||
orientation: '',
|
||||
projectionType: null,
|
||||
height: 3840,
|
||||
width: 2160,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
edits: [
|
||||
{
|
||||
action: AssetEditAction.Crop,
|
||||
parameters: {
|
||||
width: 1512,
|
||||
height: 1152,
|
||||
x: 216,
|
||||
y: 1512,
|
||||
},
|
||||
},
|
||||
] as AssetEditActionItem[],
|
||||
isEdited: true,
|
||||
}),
|
||||
};
|
||||
Vendored
+9
-9
@@ -1,5 +1,5 @@
|
||||
import { AssetType } from 'src/enum';
|
||||
import { previewFile } from 'test/fixtures/asset.stub';
|
||||
import { AssetFileType, AssetType } from 'src/enum';
|
||||
import { AssetFileFactory } from 'test/factories/asset-file.factory';
|
||||
import { userStub } from 'test/fixtures/user.stub';
|
||||
|
||||
const updateId = '0d1173e3-4d80-4d76-b41e-57d56de21125';
|
||||
@@ -179,7 +179,7 @@ export const personThumbnailStub = {
|
||||
type: AssetType.Image,
|
||||
originalPath: '/original/path.jpg',
|
||||
exifOrientation: '1',
|
||||
previewPath: previewFile.path,
|
||||
previewPath: AssetFileFactory.create({ type: AssetFileType.Preview }).path,
|
||||
}),
|
||||
newThumbnailMiddle: Object.freeze({
|
||||
ownerId: userStub.admin.id,
|
||||
@@ -192,7 +192,7 @@ export const personThumbnailStub = {
|
||||
type: AssetType.Image,
|
||||
originalPath: '/original/path.jpg',
|
||||
exifOrientation: '1',
|
||||
previewPath: previewFile.path,
|
||||
previewPath: AssetFileFactory.create({ type: AssetFileType.Preview }).path,
|
||||
}),
|
||||
newThumbnailEnd: Object.freeze({
|
||||
ownerId: userStub.admin.id,
|
||||
@@ -205,7 +205,7 @@ export const personThumbnailStub = {
|
||||
type: AssetType.Image,
|
||||
originalPath: '/original/path.jpg',
|
||||
exifOrientation: '1',
|
||||
previewPath: previewFile.path,
|
||||
previewPath: AssetFileFactory.create({ type: AssetFileType.Preview }).path,
|
||||
}),
|
||||
rawEmbeddedThumbnail: Object.freeze({
|
||||
ownerId: userStub.admin.id,
|
||||
@@ -218,7 +218,7 @@ export const personThumbnailStub = {
|
||||
type: AssetType.Image,
|
||||
originalPath: '/original/path.dng',
|
||||
exifOrientation: '1',
|
||||
previewPath: previewFile.path,
|
||||
previewPath: AssetFileFactory.create({ type: AssetFileType.Preview }).path,
|
||||
}),
|
||||
negativeCoordinate: Object.freeze({
|
||||
ownerId: userStub.admin.id,
|
||||
@@ -231,7 +231,7 @@ export const personThumbnailStub = {
|
||||
type: AssetType.Image,
|
||||
originalPath: '/original/path.jpg',
|
||||
exifOrientation: '1',
|
||||
previewPath: previewFile.path,
|
||||
previewPath: AssetFileFactory.create({ type: AssetFileType.Preview }).path,
|
||||
}),
|
||||
overflowingCoordinate: Object.freeze({
|
||||
ownerId: userStub.admin.id,
|
||||
@@ -244,7 +244,7 @@ export const personThumbnailStub = {
|
||||
type: AssetType.Image,
|
||||
originalPath: '/original/path.jpg',
|
||||
exifOrientation: '1',
|
||||
previewPath: previewFile.path,
|
||||
previewPath: AssetFileFactory.create({ type: AssetFileType.Preview }).path,
|
||||
}),
|
||||
videoThumbnail: Object.freeze({
|
||||
ownerId: userStub.admin.id,
|
||||
@@ -257,6 +257,6 @@ export const personThumbnailStub = {
|
||||
type: AssetType.Video,
|
||||
originalPath: '/original/path.mp4',
|
||||
exifOrientation: '1',
|
||||
previewPath: previewFile.path,
|
||||
previewPath: AssetFileFactory.create({ type: AssetFileType.Preview }).path,
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { AssetFactory } from 'test/factories/asset.factory';
|
||||
|
||||
export const getForStorageTemplate = (asset: ReturnType<AssetFactory['build']>) => {
|
||||
return {
|
||||
id: asset.id,
|
||||
ownerId: asset.ownerId,
|
||||
livePhotoVideoId: asset.livePhotoVideoId,
|
||||
type: asset.type,
|
||||
isExternal: asset.isExternal,
|
||||
checksum: asset.checksum,
|
||||
timeZone: asset.exifInfo.timeZone,
|
||||
fileCreatedAt: asset.fileCreatedAt,
|
||||
originalPath: asset.originalPath,
|
||||
originalFileName: asset.originalFileName,
|
||||
fileSizeInByte: asset.exifInfo.fileSizeInByte,
|
||||
files: asset.files,
|
||||
make: asset.exifInfo.make,
|
||||
model: asset.exifInfo.model,
|
||||
lensModel: asset.exifInfo.lensModel,
|
||||
isEdited: asset.isEdited,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user