Spaces:
Running
Running
| import { | |
| Controller, | |
| Get, | |
| Post, | |
| Param, | |
| UseGuards, | |
| Request, | |
| HttpCode, | |
| HttpStatus, | |
| } from '@nestjs/common'; | |
| import { MonitoringEngineService } from './monitoring-engine.service'; | |
| import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard'; | |
| ('monitoring-engine') | |
| (JwtAuthGuard) | |
| export class MonitoringEngineController { | |
| constructor( | |
| private readonly monitoringEngineService: MonitoringEngineService, | |
| ) {} | |
| ('state') | |
| (HttpStatus.OK) | |
| async getMonitoringState(() req: any) { | |
| const userId = req.user.id; | |
| const state = await this.monitoringEngineService.getMonitoringState(userId); | |
| return state; | |
| } | |
| ('follow-ups') | |
| (HttpStatus.OK) | |
| async getPendingFollowUps(() req: any) { | |
| const userId = req.user.id; | |
| const followUps = await this.monitoringEngineService.getPendingFollowUpTasks( | |
| userId, | |
| ); | |
| return followUps; | |
| } | |
| ('follow-ups/:id/complete') | |
| (HttpStatus.OK) | |
| async completeFollowUp(() req: any, ('id') id: string) { | |
| const userId = req.user.id; // Ensure the user owns the task | |
| // In a real application, you'd add a check here to ensure the task belongs to the user | |
| const completedTask = await this.monitoringEngineService.completeFollowUpTask( | |
| id, | |
| ); | |
| return completedTask; | |
| } | |
| } | |