mirror of https://github.com/immich-app/immich.git
18 lines
721 B
TypeScript
18 lines
721 B
TypeScript
import { Inject } from '@nestjs/common';
|
|
import { AssetResponseDto, mapAsset } from 'src/dtos/asset-response.dto';
|
|
import { AuthDto } from 'src/dtos/auth.dto';
|
|
import { IViewRepository } from 'src/interfaces/view.interface';
|
|
|
|
export class ViewService {
|
|
constructor(@Inject(IViewRepository) private viewRepository: IViewRepository) {}
|
|
|
|
getUniqueOriginalPaths(auth: AuthDto): Promise<string[]> {
|
|
return this.viewRepository.getUniqueOriginalPaths(auth.user.id);
|
|
}
|
|
|
|
async getAssetsByOriginalPath(auth: AuthDto, path: string): Promise<AssetResponseDto[]> {
|
|
const assets = await this.viewRepository.getAssetsByOriginalPath(auth.user.id, path);
|
|
return assets.map((asset) => mapAsset(asset, { auth }));
|
|
}
|
|
}
|