Files
immich/server/src/services/view.service.ts
2025-02-11 22:15:56 +00:00

18 lines
750 B
TypeScript

import { Injectable } from '@nestjs/common';
import { AssetResponseDto, mapAsset } from 'src/dtos/asset-response.dto';
import { AuthDto } from 'src/dtos/auth.dto';
import { AssetEntity } from 'src/entities/asset.entity';
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 as unknown as AssetEntity, { auth }));
}
}