import { Body, Controller, Del, Get, Inject, Param, Post, } from '@midwayjs/core'; import { ConfigService } from '../../service/system/config.service'; import { RF } from '../../response/CustomerResponse'; import { ServiceError } from '../../error/CustomerError.error'; import { ErrorCode } from '../../error/Codes'; @Controller('/config') export class ConfigController { @Inject() service: ConfigService; @Post('/') async create() { throw new ServiceError(ErrorCode.INTERFACE_NOT_OPEN); } @Get('/') async query() { const result = await this.service.getConfig(); return RF.success(result); } @Get('/:id') async fetch(@Param('id') id: number) { throw new ServiceError(ErrorCode.INTERFACE_NOT_OPEN); } @Post('/:id') async update(@Param('id') id: number, @Body() body) { const result = await this.service.update({ id }, body); return RF.success(result) } @Del('/:id') async delete(@Param('id') id: number) { throw new ServiceError(ErrorCode.INTERFACE_NOT_OPEN); } }