feat(server): CLIP search integration (#1939)

This commit is contained in:
Alex
2023-03-18 08:44:42 -05:00
committed by GitHub
parent 0d436db3ea
commit f56eaae019
46 changed files with 673 additions and 773 deletions

View File

@@ -11,7 +11,10 @@ export class AssetCore {
async save(asset: Partial<AssetEntity>) {
const _asset = await this.assetRepository.save(asset);
await this.jobRepository.queue({ name: JobName.SEARCH_INDEX_ASSET, data: { asset: _asset } });
await this.jobRepository.queue({
name: JobName.SEARCH_INDEX_ASSET,
data: { ids: [_asset.id] },
});
return _asset;
}

View File

@@ -7,6 +7,7 @@ export interface AssetSearchOptions {
export const IAssetRepository = 'IAssetRepository';
export interface IAssetRepository {
getByIds(ids: string[]): Promise<AssetEntity[]>;
deleteAll(ownerId: string): Promise<void>;
getAll(options?: AssetSearchOptions): Promise<AssetEntity[]>;
save(asset: Partial<AssetEntity>): Promise<AssetEntity>;

View File

@@ -54,7 +54,7 @@ describe(AssetService.name, () => {
expect(assetMock.save).toHaveBeenCalledWith(assetEntityStub.image);
expect(jobMock.queue).toHaveBeenCalledWith({
name: JobName.SEARCH_INDEX_ASSET,
data: { asset: assetEntityStub.image },
data: { ids: [assetEntityStub.image.id] },
});
});
});