mirror of
https://github.com/immich-app/immich.git
synced 2025-01-04 02:46:47 +01:00
3432b4625f
* Regenerate missing person thumbnails * Check for empty string instead of zero length * Remember asset used as person face * Define entity relation between person and asset via faceAssetId * Typo * Fix entity relation * Tests * Tests * Fix code formatting * Fix import path * Fix migration * format * Fix entity and migration * Linting * Remove unneeded cast * Conventions * Simplify queries * Simplify queries * Remove unneeded typings from entity * Remove unneeded cast --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
132 lines
3.5 KiB
TypeScript
132 lines
3.5 KiB
TypeScript
import { PersonEntity } from '@app/infra/entities';
|
|
import { assetStub } from '@test/fixtures/asset.stub';
|
|
import { userStub } from './user.stub';
|
|
|
|
export const personStub = {
|
|
noName: Object.freeze<PersonEntity>({
|
|
id: 'person-1',
|
|
createdAt: new Date('2021-01-01'),
|
|
updatedAt: new Date('2021-01-01'),
|
|
ownerId: userStub.admin.id,
|
|
owner: userStub.admin,
|
|
name: '',
|
|
birthDate: null,
|
|
thumbnailPath: '/path/to/thumbnail.jpg',
|
|
faces: [],
|
|
faceAssetId: null,
|
|
faceAsset: null,
|
|
isHidden: false,
|
|
}),
|
|
hidden: Object.freeze<PersonEntity>({
|
|
id: 'person-1',
|
|
createdAt: new Date('2021-01-01'),
|
|
updatedAt: new Date('2021-01-01'),
|
|
ownerId: userStub.admin.id,
|
|
owner: userStub.admin,
|
|
name: '',
|
|
birthDate: null,
|
|
thumbnailPath: '/path/to/thumbnail.jpg',
|
|
faces: [],
|
|
faceAssetId: null,
|
|
faceAsset: null,
|
|
isHidden: true,
|
|
}),
|
|
withName: Object.freeze<PersonEntity>({
|
|
id: 'person-1',
|
|
createdAt: new Date('2021-01-01'),
|
|
updatedAt: new Date('2021-01-01'),
|
|
ownerId: userStub.admin.id,
|
|
owner: userStub.admin,
|
|
name: 'Person 1',
|
|
birthDate: null,
|
|
thumbnailPath: '/path/to/thumbnail.jpg',
|
|
faces: [],
|
|
faceAssetId: null,
|
|
faceAsset: null,
|
|
isHidden: false,
|
|
}),
|
|
noBirthDate: Object.freeze<PersonEntity>({
|
|
id: 'person-1',
|
|
createdAt: new Date('2021-01-01'),
|
|
updatedAt: new Date('2021-01-01'),
|
|
ownerId: userStub.admin.id,
|
|
owner: userStub.admin,
|
|
name: 'Person 1',
|
|
birthDate: null,
|
|
thumbnailPath: '/path/to/thumbnail.jpg',
|
|
faces: [],
|
|
faceAssetId: null,
|
|
faceAsset: null,
|
|
isHidden: false,
|
|
}),
|
|
withBirthDate: Object.freeze<PersonEntity>({
|
|
id: 'person-1',
|
|
createdAt: new Date('2021-01-01'),
|
|
updatedAt: new Date('2021-01-01'),
|
|
ownerId: userStub.admin.id,
|
|
owner: userStub.admin,
|
|
name: 'Person 1',
|
|
birthDate: new Date('1976-06-30'),
|
|
thumbnailPath: '/path/to/thumbnail.jpg',
|
|
faces: [],
|
|
faceAssetId: null,
|
|
faceAsset: null,
|
|
isHidden: false,
|
|
}),
|
|
noThumbnail: Object.freeze<PersonEntity>({
|
|
id: 'person-1',
|
|
createdAt: new Date('2021-01-01'),
|
|
updatedAt: new Date('2021-01-01'),
|
|
ownerId: userStub.admin.id,
|
|
owner: userStub.admin,
|
|
name: '',
|
|
birthDate: null,
|
|
thumbnailPath: '',
|
|
faces: [],
|
|
faceAssetId: null,
|
|
faceAsset: null,
|
|
isHidden: false,
|
|
}),
|
|
newThumbnail: Object.freeze<PersonEntity>({
|
|
id: 'person-1',
|
|
createdAt: new Date('2021-01-01'),
|
|
updatedAt: new Date('2021-01-01'),
|
|
ownerId: userStub.admin.id,
|
|
owner: userStub.admin,
|
|
name: '',
|
|
birthDate: null,
|
|
thumbnailPath: '/new/path/to/thumbnail.jpg',
|
|
faces: [],
|
|
faceAssetId: assetStub.image.id,
|
|
faceAsset: assetStub.image,
|
|
isHidden: false,
|
|
}),
|
|
primaryPerson: Object.freeze<PersonEntity>({
|
|
id: 'person-1',
|
|
createdAt: new Date('2021-01-01'),
|
|
updatedAt: new Date('2021-01-01'),
|
|
ownerId: userStub.admin.id,
|
|
owner: userStub.admin,
|
|
name: 'Person 1',
|
|
birthDate: null,
|
|
thumbnailPath: '/path/to/thumbnail',
|
|
faces: [],
|
|
faceAssetId: null,
|
|
faceAsset: null,
|
|
isHidden: false,
|
|
}),
|
|
mergePerson: Object.freeze<PersonEntity>({
|
|
id: 'person-2',
|
|
createdAt: new Date('2021-01-01'),
|
|
updatedAt: new Date('2021-01-01'),
|
|
ownerId: userStub.admin.id,
|
|
owner: userStub.admin,
|
|
name: 'Person 2',
|
|
birthDate: null,
|
|
thumbnailPath: '/path/to/thumbnail',
|
|
faces: [],
|
|
faceAssetId: null,
|
|
faceAsset: null,
|
|
isHidden: false,
|
|
}),
|
|
};
|