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 { return this.service.getConfig(); } @Get('defaults') getConfigDefaults(): SystemConfigDto { return this.service.getDefaults(); } @Put() updateConfig(@Body() dto: SystemConfigDto): Promise { 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); } }