import { Body, Controller, Get, Param, Post } from '@nestjs/common';
import { DashboardService } from '../../services/dashboard.service';
import { Config } from '../../entities/configs.entity';
import { ConfigsService } from '../../services/configs.service';
import { UpsertConfigDto } from '../../dto/config/upsert-config.dto';

@Controller('admin/configs')
export class AdminConfigsController {
  constructor(private readonly configsService: ConfigsService) {}

  @Post('upsert')
  async upsertConfig(@Body() data: UpsertConfigDto) {
    return await this.configsService.upsertConfig(data);
  }

  @Get(':key')
  async getConfig(@Param('key') key: Config['key_name']) {
    return await this.configsService.getConfigRes(key);
  }
}
