import { Body, Controller, Get, Param, Post } from '@nestjs/common'; import { ApiBody, ApiTags } from '@nestjs/swagger'; import { NestjsOemcService } from './nestjs-oemc.service'; @ApiTags('nestjs-oemc') @Controller('oemc') export class NestjsOemcController { constructor(private nestjsOemcService: NestjsOemcService) {} @Get('controllers') getOemcControllerNames(): object[] { return this.nestjsOemcService.getOemcControllerNames(); } @Get('controllers/:controllerName/methods') getOemcControllerFunctionNames(@Param('controllerName') controllerName: string) { return this.nestjsOemcService.getOemcMethods(controllerName); } @ApiBody({ type: Object }) @Post('controllers/:controllerName/methods/:methodName/execute') async executeOemcFunction( @Param('controllerName') controllerName: string, @Param('methodName') methodName: string, @Body() body: object, ) { return await this.nestjsOemcService.executeOemcFunction(controllerName, methodName, body); } }