2023-01-21 11:11:55 -05:00
|
|
|
import { SystemConfigDto, SystemConfigService, SystemConfigTemplateStorageOptionDto } from '@app/domain';
|
2023-11-09 17:10:56 +01:00
|
|
|
import { MapThemeDto } from '@app/domain/system-config/system-config-map-theme.dto';
|
|
|
|
|
import { Body, Controller, Get, Put, Query } from '@nestjs/common';
|
2023-02-24 17:01:10 +01:00
|
|
|
import { ApiTags } from '@nestjs/swagger';
|
2023-07-01 14:27:34 -04:00
|
|
|
import { Authenticated } from '../app.guard';
|
|
|
|
|
import { UseValidation } from '../app.utils';
|
2022-11-14 23:39:32 -05:00
|
|
|
|
|
|
|
|
@ApiTags('System Config')
|
|
|
|
|
@Controller('system-config')
|
2023-03-24 00:53:56 -04:00
|
|
|
@Authenticated({ admin: true })
|
2023-04-03 06:24:18 +02:00
|
|
|
@UseValidation()
|
2022-11-14 23:39:32 -05:00
|
|
|
export class SystemConfigController {
|
2023-03-24 00:53:56 -04:00
|
|
|
constructor(private readonly service: SystemConfigService) {}
|
2022-11-14 23:39:32 -05:00
|
|
|
|
|
|
|
|
@Get()
|
2023-03-24 00:53:56 -04:00
|
|
|
getConfig(): Promise<SystemConfigDto> {
|
|
|
|
|
return this.service.getConfig();
|
2022-11-14 23:39:32 -05:00
|
|
|
}
|
|
|
|
|
|
2022-12-09 15:51:42 -05:00
|
|
|
@Get('defaults')
|
2023-11-03 21:33:15 -04:00
|
|
|
getConfigDefaults(): SystemConfigDto {
|
2023-03-24 00:53:56 -04:00
|
|
|
return this.service.getDefaults();
|
2022-12-09 15:51:42 -05:00
|
|
|
}
|
|
|
|
|
|
2022-11-14 23:39:32 -05:00
|
|
|
@Put()
|
2023-03-31 17:14:01 +02:00
|
|
|
updateConfig(@Body() dto: SystemConfigDto): Promise<SystemConfigDto> {
|
2023-03-24 00:53:56 -04:00
|
|
|
return this.service.updateConfig(dto);
|
2022-11-14 23:39:32 -05:00
|
|
|
}
|
2022-12-16 14:26:12 -06:00
|
|
|
|
|
|
|
|
@Get('storage-template-options')
|
2023-03-24 00:53:56 -04:00
|
|
|
getStorageTemplateOptions(): SystemConfigTemplateStorageOptionDto {
|
|
|
|
|
return this.service.getStorageTemplateOptions();
|
2022-12-16 14:26:12 -06:00
|
|
|
}
|
2023-11-09 17:10:56 +01:00
|
|
|
|
|
|
|
|
@Get('map/style.json')
|
|
|
|
|
getMapStyle(@Query() dto: MapThemeDto) {
|
|
|
|
|
return this.service.getMapStyle(dto.theme);
|
|
|
|
|
}
|
2022-11-14 23:39:32 -05:00
|
|
|
}
|