import { Controller, Get } from '@nestjs/common';
import { PusherChannel, PusherSendGuard } from 'nestjs-pusher';
const shouldSend = (req: any, res: any, eventName: string) => {
return true
}
@Controller('cats')
export class CatsController {
constructor(private readonly catService: CatService) {
}
@PusherSendGuard(shouldSend)
@PusherChannel('private-channel-of-cats')
@PusherEvent('cat.created')
@Post()
async createCat(@Body() dto): string {
const newCat = await this.catService.create(dto)
return newCat
}
}