omnichannel-backend/src/modules/admin/agent-notes.controller.ts

23 lines
728 B
TypeScript

import { Body, Controller, Delete, Get, Param, Post, Query } from '@nestjs/common';
import { AgentNotesService } from './agent-notes.service';
@Controller('agent/notes')
export class AgentNotesController {
constructor(private readonly agentNotesService: AgentNotesService) {}
@Get()
listNotes(@Query('userId') userId: string) {
return this.agentNotesService.listNotes(Number(userId));
}
@Post()
createNote(@Body() body: { userId: number; text: string }) {
return this.agentNotesService.createNote(Number(body.userId), body.text);
}
@Delete(':id')
deleteNote(@Param('id') id: string, @Query('userId') userId: string) {
return this.agentNotesService.deleteNote(Number(userId), Number(id));
}
}