mirror of
https://github.com/immich-app/immich.git
synced 2025-12-24 17:24:56 +03:00
* feat(server): pagination for asset queries in jobs * default mock value for getAll * remove live photo name correction * order paginated results by createdAt * change log level * move usePagination to domain
21 lines
704 B
TypeScript
21 lines
704 B
TypeScript
import { AssetEntity } from '@app/infra/entities';
|
|
import { IJobRepository, JobName } from '../job';
|
|
import { IAssetRepository, LivePhotoSearchOptions } from './asset.repository';
|
|
|
|
export class AssetCore {
|
|
constructor(private assetRepository: IAssetRepository, private jobRepository: IJobRepository) {}
|
|
|
|
async save(asset: Partial<AssetEntity>) {
|
|
const _asset = await this.assetRepository.save(asset);
|
|
await this.jobRepository.queue({
|
|
name: JobName.SEARCH_INDEX_ASSET,
|
|
data: { ids: [_asset.id] },
|
|
});
|
|
return _asset;
|
|
}
|
|
|
|
findLivePhotoMatch(options: LivePhotoSearchOptions): Promise<AssetEntity | null> {
|
|
return this.assetRepository.findLivePhotoMatch(options);
|
|
}
|
|
}
|