1
0
forked from Cutlery/immich
immich-quadlet/server/apps/immich/src/controllers/system-config.controller.ts
Michel Heusschen c584791b65
feat(server): improve validation in controllers (#2149)
* feat(server): improve validation in controllers

* set ValidationPipe config with decorator
2023-04-02 23:24:18 -05:00

34 lines
1.0 KiB
TypeScript

import { SystemConfigDto, SystemConfigService, SystemConfigTemplateStorageOptionDto } from '@app/domain';
import { Body, Controller, Get, Put } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { Authenticated } from '../decorators/authenticated.decorator';
import { UseValidation } from '../decorators/use-validation.decorator';
@ApiTags('System Config')
@Controller('system-config')
@Authenticated({ admin: true })
@UseValidation()
export class SystemConfigController {
constructor(private readonly service: SystemConfigService) {}
@Get()
getConfig(): Promise<SystemConfigDto> {
return this.service.getConfig();
}
@Get('defaults')
getDefaults(): SystemConfigDto {
return this.service.getDefaults();
}
@Put()
updateConfig(@Body() dto: SystemConfigDto): Promise<SystemConfigDto> {
return this.service.updateConfig(dto);
}
@Get('storage-template-options')
getStorageTemplateOptions(): SystemConfigTemplateStorageOptionDto {
return this.service.getStorageTemplateOptions();
}
}