feat: add user plan to the user ticket info for admin
This commit is contained in:
@@ -286,9 +286,11 @@ export class TicketsService {
|
||||
if (!ticket) throw new BadRequestException(TicketMessageEnum.TICKET_NOT_FOUND);
|
||||
|
||||
const messages = await this.ticketMessagesRepository.findMessagesByTicketId(ticketId);
|
||||
const userSupportPlan = await this.supportPlansService.getUserSupportPlanOfUser(ticket.user.id);
|
||||
return {
|
||||
ticket,
|
||||
messages,
|
||||
supportPlan: userSupportPlan,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -312,6 +314,19 @@ export class TicketsService {
|
||||
message: TicketMessageEnum.CLOSED,
|
||||
};
|
||||
}
|
||||
//******************************** * /
|
||||
async openTicketByAdmin(ticketId: string) {
|
||||
const ticket = await this.ticketsRepository.findTicketById(ticketId);
|
||||
if (!ticket) throw new BadRequestException(TicketMessageEnum.TICKET_NOT_FOUND);
|
||||
|
||||
ticket.status = TicketStatus.PENDING;
|
||||
await this.ticketsRepository.save(ticket);
|
||||
|
||||
return {
|
||||
message: TicketMessageEnum.OPENED,
|
||||
};
|
||||
}
|
||||
|
||||
//******************************** */
|
||||
async referTicket(ticketId: string, userId: string, referDto: ReferTicketDto) {
|
||||
const queryRunner = this.dataSource.createQueryRunner();
|
||||
|
||||
@@ -107,6 +107,14 @@ export class TicketsController {
|
||||
return this.ticketsService.closeTicketByUser(paramDto.id, userId, isAdmin);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "open ticket by admin" })
|
||||
@AdminRoute()
|
||||
@PermissionsDec(PermissionEnum.TICKETS)
|
||||
@Post(":id/open")
|
||||
openTicketByAdmin(@Param() paramDto: ParamDto) {
|
||||
return this.ticketsService.openTicketByAdmin(paramDto.id);
|
||||
}
|
||||
|
||||
@ApiOperation({ summary: "referer ticket ==> admin route" })
|
||||
@AdminRoute()
|
||||
@PermissionsDec(PermissionEnum.TICKETS)
|
||||
|
||||
Reference in New Issue
Block a user