chat-management.controller.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import { Controller, Get, Query } from '@nestjs/common'
  2. import { ApiOperation, ApiTags } from '@nestjs/swagger'
  3. import {
  4. GetStaffSessionSummaryDto,
  5. GetStaffListDto,
  6. GetStaffSessionListDto,
  7. GetConversationListDto
  8. } from '@/dto/chat-management'
  9. import { ChatManagementService } from './service/chat-management.service'
  10. @ApiTags('chat-management')
  11. @Controller('chat-management')
  12. export class ChatManagementController {
  13. constructor(private readonly chatManagementService: ChatManagementService) {}
  14. @Get('staff-session-summary')
  15. @ApiOperation({ summary: '获取客服会话总览' })
  16. async getStaffSessionSummary(@Query() query: GetStaffSessionSummaryDto) {
  17. const { staffId, status, page, size } = query
  18. console.log(staffId, status, page, size)
  19. return this.chatManagementService.getStaffSessionSummary(
  20. staffId,
  21. status,
  22. page,
  23. size
  24. )
  25. }
  26. @Get('staff-list')
  27. @ApiOperation({ summary: '获取客服列表' })
  28. async getStaffList(@Query() query: GetStaffListDto) {
  29. const { page, size } = query
  30. return this.chatManagementService.getStaffList(page, size)
  31. }
  32. @Get('staff-session-list')
  33. @ApiOperation({ summary: '获取客服会话列表' })
  34. async getStaffSessionList(@Query() query: GetStaffSessionListDto) {
  35. const { staffId, page, pageSize } = query
  36. return this.chatManagementService.getStaffSessionList(
  37. staffId,
  38. page,
  39. pageSize
  40. )
  41. }
  42. @Get('conversation-list')
  43. @ApiOperation({ summary: '获取会话列表' })
  44. async getConversationList(@Query() query: GetConversationListDto) {
  45. const { customerId, staffId, status, page, size } = query
  46. return this.chatManagementService.getConversationList(
  47. customerId,
  48. staffId,
  49. status,
  50. page,
  51. size
  52. )
  53. }
  54. }