forked from Cutlery/immich
* feat(server): improve validation in controllers * set ValidationPipe config with decorator
34 lines
1.0 KiB
TypeScript
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();
|
|
}
|
|
}
|