1
0
forked from Cutlery/immich
immich-quadlet/server/src/controllers/system-config.controller.ts
Daniel Dietzler ef4a492cb1
chore(server): move services (#8133)
move services
2024-03-20 18:07:30 -05:00

41 lines
1.3 KiB
TypeScript

import { Body, Controller, Get, Put, Query } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { MapThemeDto } from 'src/dtos/system-config-map-theme.dto';
import { SystemConfigTemplateStorageOptionDto } from 'src/dtos/system-config-storage-template.dto';
import { SystemConfigDto } from 'src/dtos/system-config.dto';
import { AdminRoute, Authenticated } from 'src/middleware/auth.guard';
import { SystemConfigService } from 'src/services/system-config.service';
@ApiTags('System Config')
@Controller('system-config')
@Authenticated({ admin: true })
export class SystemConfigController {
constructor(private readonly service: SystemConfigService) {}
@Get()
getConfig(): Promise<SystemConfigDto> {
return this.service.getConfig();
}
@Get('defaults')
getConfigDefaults(): 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();
}
@AdminRoute(false)
@Get('map/style.json')
getMapStyle(@Query() dto: MapThemeDto) {
return this.service.getMapStyle(dto.theme);
}
}