import { Body, Controller, Del, Get, Inject, Param, Post, } from '@midwayjs/core'; import { MenusService } from '../../service/system/menus.service'; import { RF } from '../../response/CustomerResponse'; @Controller('/menus') export class MenusController { @Inject() service: MenusService; @Post('/') async create(@Body() body) { const data = await this.service.create(body); return RF.success(data); } @Get('/') async query() { const result = await this.service.queryMenu(); return RF.success(result); } @Get('/:id') async fetch(@Param('id') id: string) { const result = await this.service.fetch({ id }); return RF.success(result); } @Post('/:id') async update(@Param('id') id: string, @Body() body) { const result = await this.service.update({ id }, body); return RF.success(result); } @Del('/:id') async delete(@Param('id') id: string) { await this.service.delete({ id }); return RF.success(); } }