import { Controller, Post, Body, HttpCode, HttpStatus, Req, UseGuards, Get, Param, Put, Inject, Delete, } from '@nestjs/common'; import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard'; import { WorkflowService } from '../service/workflow.service'; import { PopulateWorkflowService } from '../service/populate-workflow.service'; @Controller('/workflow') @UseGuards(JwtAuthGuard) export class WorkflowController { constructor( @Inject('WorkflowService') private readonly workflowService: WorkflowService, private readonly populateWorkflowService: PopulateWorkflowService, ) {} @Post('/getAllWorkflows') @HttpCode(HttpStatus.OK) async getAllWorkflows( @Req() req: Request & { user: any }, @Body() body: { entity_type: string }, ) { const { level_id, level_type } = req.user.userData; return this.workflowService.getAllWorkflows( body.entity_type, level_id, level_type, ); } @Get('/getWorkflowById/:id') @HttpCode(HttpStatus.OK) async getWorkflowById(@Param('id') id: number) { return this.workflowService.getWorkflowById(id); } SS; @Post('/updateSequence') @HttpCode(HttpStatus.OK) async updateSequence(@Body() body: any, @Req() req: Request & { user: any }) { const loggedInUser = req.user?.userData; return this.workflowService.updateSequence(body, loggedInUser); } @Post('/populateWorkflow') async populateWorkflow( @Body() body: any, @Req() req: Request & { user: any }, ) { const loggedInUser = req.user?.userData; return this.populateWorkflowService.populateWorkflowData( body.organization_id, loggedInUser, ); } }