import { Body, Controller, Get, Param, Post } from '@nestjs/common'
import { ApiTags } from '@nestjs/swagger'
import { Public } from '../auth/public.decorator'
import { SysConfigService } from './sys-config.service'
import { SysConfig } from './entities/sys-config.entity'
import { PageRequest } from '../common/dto/page-request'

@ApiTags('sys-config')
@Controller('/sys-config')
@Public()
export class SysConfigController {
    constructor(private readonly sysConfigService: SysConfigService) {}

    @Post()
    public async list(@Body() page: PageRequest<SysConfig>) {
        return await this.sysConfigService.findAll(page)
    }

    @Get('/:name')
    async getSysConfigByName(@Param('name') name: string) {
        return await this.sysConfigService.findByName(name)
    }
}
