import { Socket } from 'socket.io' ; import { BaseWSController } from '../../../../shared/infra/http/models/BaseWSController' ; import { payloadSchema } from '../../../chat/useCases/sendChatMessage/SendChatMessageDTO' ; import { SetActiveCanvasDTO } from './SetActiveCanvasDTO' ; import { SetActiveCanvasUseCase } from './SetActiveCanvasUseCase' ; import { logger } from "../../../../logger" ; export class SetActiveCanvasController extends BaseWSController { private useCase : SetActiveCanvasUseCase ; constructor ( useCase ) { super ( payloadSchema ) ; this . useCase = useCase ; } async executeImpl ( socket , dto ) { try { socket . to ( dto . meetingId ) . emit ( 'active-canvas-change' , { meetingId : dto . meetingId , canvasId : dto . canvasId , } ) ; await this . useCase . execute ( dto ) ; } catch ( err ) { logger . error ( { error : err } , err ) ; } } }