mirror of
https://github.com/immich-app/immich.git
synced 2026-03-14 05:40:01 -04:00
20 lines
690 B
TypeScript
20 lines
690 B
TypeScript
import { BadRequestException, Injectable } from '@nestjs/common';
|
|
import { mapPlugin, PluginResponseDto, PluginSearchDto } from 'src/dtos/plugin.dto';
|
|
import { BaseService } from 'src/services/base.service';
|
|
|
|
@Injectable()
|
|
export class PluginService extends BaseService {
|
|
async search(dto: PluginSearchDto): Promise<PluginResponseDto[]> {
|
|
const plugins = await this.pluginRepository.search(dto);
|
|
return plugins.map((plugin) => mapPlugin(plugin));
|
|
}
|
|
|
|
async get(id: string): Promise<PluginResponseDto> {
|
|
const plugin = await this.pluginRepository.get(id);
|
|
if (!plugin) {
|
|
throw new BadRequestException('Plugin not found');
|
|
}
|
|
return mapPlugin(plugin);
|
|
}
|
|
}
|