Files
immich/server/src/services/view.service.ts
2025-04-18 23:10:34 +02:00

17 lines
667 B
TypeScript

import { Injectable } from '@nestjs/common';
import { AssetResponseDto, mapAsset } from 'src/dtos/asset-response.dto';
import { AuthDto } from 'src/dtos/auth.dto';
import { BaseService } from 'src/services/base.service';
@Injectable()
export class ViewService extends BaseService {
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 }));
}
}