1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-08 23:07:06 +02:00

refactor: migrate person repository to kysely (#15242)

* refactor: migrate person repository to kysely

* `asVector` begone

* linting

* fix metadata faces

* update test

---------

Co-authored-by: Alex <alex.tran1502@gmail.com>
Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com>
This commit is contained in:
Daniel Dietzler
2025-01-21 19:12:28 +01:00
committed by GitHub
parent 0c152366ec
commit 332a865ce6
29 changed files with 715 additions and 747 deletions

View File

@ -824,7 +824,7 @@ export const assetStub = {
duplicateId: null,
smartSearch: {
assetId: 'asset-id',
embedding: Array.from({ length: 512 }, Math.random),
embedding: '[1, 2, 3, 4]',
},
isOffline: false,
}),
@ -866,7 +866,7 @@ export const assetStub = {
duplicateId: 'duplicate-id',
smartSearch: {
assetId: 'asset-id',
embedding: Array.from({ length: 512 }, Math.random),
embedding: '[1, 2, 3, 4]',
},
isOffline: false,
}),

View File

@ -19,7 +19,7 @@ export const faceStub = {
imageHeight: 1024,
imageWidth: 1024,
sourceType: SourceType.MACHINE_LEARNING,
faceSearch: { faceId: 'assetFaceId1', embedding: [1, 2, 3, 4] },
faceSearch: { faceId: 'assetFaceId1', embedding: '[1, 2, 3, 4]' },
}),
primaryFace1: Object.freeze<NonNullableProperty<AssetFaceEntity>>({
id: 'assetFaceId2',
@ -34,7 +34,7 @@ export const faceStub = {
imageHeight: 1024,
imageWidth: 1024,
sourceType: SourceType.MACHINE_LEARNING,
faceSearch: { faceId: 'assetFaceId2', embedding: [1, 2, 3, 4] },
faceSearch: { faceId: 'assetFaceId2', embedding: '[1, 2, 3, 4]' },
}),
mergeFace1: Object.freeze<NonNullableProperty<AssetFaceEntity>>({
id: 'assetFaceId3',
@ -49,7 +49,7 @@ export const faceStub = {
imageHeight: 1024,
imageWidth: 1024,
sourceType: SourceType.MACHINE_LEARNING,
faceSearch: { faceId: 'assetFaceId3', embedding: [1, 2, 3, 4] },
faceSearch: { faceId: 'assetFaceId3', embedding: '[1, 2, 3, 4]' },
}),
start: Object.freeze<NonNullableProperty<AssetFaceEntity>>({
id: 'assetFaceId5',
@ -64,7 +64,7 @@ export const faceStub = {
imageHeight: 2880,
imageWidth: 2160,
sourceType: SourceType.MACHINE_LEARNING,
faceSearch: { faceId: 'assetFaceId5', embedding: [1, 2, 3, 4] },
faceSearch: { faceId: 'assetFaceId5', embedding: '[1, 2, 3, 4]' },
}),
middle: Object.freeze<NonNullableProperty<AssetFaceEntity>>({
id: 'assetFaceId6',
@ -79,7 +79,7 @@ export const faceStub = {
imageHeight: 500,
imageWidth: 400,
sourceType: SourceType.MACHINE_LEARNING,
faceSearch: { faceId: 'assetFaceId6', embedding: [1, 2, 3, 4] },
faceSearch: { faceId: 'assetFaceId6', embedding: '[1, 2, 3, 4]' },
}),
end: Object.freeze<NonNullableProperty<AssetFaceEntity>>({
id: 'assetFaceId7',
@ -94,7 +94,7 @@ export const faceStub = {
imageHeight: 500,
imageWidth: 500,
sourceType: SourceType.MACHINE_LEARNING,
faceSearch: { faceId: 'assetFaceId7', embedding: [1, 2, 3, 4] },
faceSearch: { faceId: 'assetFaceId7', embedding: '[1, 2, 3, 4]' },
}),
noPerson1: Object.freeze<AssetFaceEntity>({
id: 'assetFaceId8',
@ -109,7 +109,7 @@ export const faceStub = {
imageHeight: 1024,
imageWidth: 1024,
sourceType: SourceType.MACHINE_LEARNING,
faceSearch: { faceId: 'assetFaceId8', embedding: [1, 2, 3, 4] },
faceSearch: { faceId: 'assetFaceId8', embedding: '[1, 2, 3, 4]' },
}),
noPerson2: Object.freeze<AssetFaceEntity>({
id: 'assetFaceId9',
@ -124,7 +124,7 @@ export const faceStub = {
imageHeight: 1024,
imageWidth: 1024,
sourceType: SourceType.MACHINE_LEARNING,
faceSearch: { faceId: 'assetFaceId9', embedding: [1, 2, 3, 4] },
faceSearch: { faceId: 'assetFaceId9', embedding: '[1, 2, 3, 4]' },
}),
fromExif1: Object.freeze<AssetFaceEntity>({
id: 'assetFaceId9',

View File

@ -254,3 +254,10 @@ export const mockSpawn = vitest.fn((exitCode: number, stdout: string, stderr: st
}),
} as unknown as ChildProcessWithoutNullStreams;
});
export async function* makeStream<T>(items: T[] = []): AsyncIterableIterator<T> {
for (const item of items) {
await Promise.resolve();
yield item;
}
}