You've already forked immich
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:
4
server/test/fixtures/asset.stub.ts
vendored
4
server/test/fixtures/asset.stub.ts
vendored
@ -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,
|
||||
}),
|
||||
|
16
server/test/fixtures/face.stub.ts
vendored
16
server/test/fixtures/face.stub.ts
vendored
@ -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',
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user