diff --git a/next/api/src/model/Ticket.ts b/next/api/src/model/Ticket.ts index 8fd148f21..7fbb7c39f 100644 --- a/next/api/src/model/Ticket.ts +++ b/next/api/src/model/Ticket.ts @@ -18,7 +18,6 @@ import { TicketUpdater, UpdateOptions } from '@/ticket/TicketUpdater'; import htmlify from '@/utils/htmlify'; import { emailService } from '@/support-email/services/email'; import { categoryService } from '@/category'; -import { durationMetricService } from '@/ticket/services/duration-metric'; import { Category } from './Category'; import { File } from './File'; import { Group } from './Group'; @@ -330,7 +329,7 @@ export class Ticket extends Model { } } } - const newTicket = await updater.update(data.author, { useMasterKey: true }); + await updater.update(data.author, { useMasterKey: true }); events.emit('reply:created', { reply: reply.toJSON(), @@ -344,8 +343,6 @@ export class Ticket extends Model { console.error(`[Ticket] send email to requester`, error); }); } - - await durationMetricService.recordReplyTicket(newTicket, reply, isCustomerService); } return reply; @@ -384,7 +381,6 @@ export class Ticket extends Model { (options?.cascade ? [...associateTickets, this] : [this]).map(async (ticket) => { const updater = new TicketUpdater(ticket); const updatedTicket = await updater.operate(action).update(operator, options); - await durationMetricService.recordOperateTicket(ticket, action); return updatedTicket; }) ); diff --git a/next/api/src/ticket/TicketCreator.ts b/next/api/src/ticket/TicketCreator.ts index 88588292e..9e82336a5 100644 --- a/next/api/src/ticket/TicketCreator.ts +++ b/next/api/src/ticket/TicketCreator.ts @@ -13,7 +13,6 @@ import { User, systemUser } from '@/model/User'; import { TicketLog } from '@/model/TicketLog'; import { searchTicketService } from '@/service/search-ticket'; import { ticketService } from '@/service/ticket'; -import { durationMetricService } from './services/duration-metric'; export class TicketCreator { private author?: User; @@ -274,7 +273,6 @@ export class TicketCreator { customFields: this.customFields, }); - await durationMetricService.createMetric(ticket); await searchTicketService.addSyncJob([ticket.id]); await ticketService.addDetectTicketLanguageJob(ticket.id); diff --git a/next/api/src/ticket/services/duration-metric.ts b/next/api/src/ticket/services/duration-metric.ts index c6e808a43..5888c2e02 100644 --- a/next/api/src/ticket/services/duration-metric.ts +++ b/next/api/src/ticket/services/duration-metric.ts @@ -8,6 +8,7 @@ export class DurationMetricService { createMetric(ticket: Ticket) { return DurationMetrics.create( { + ACL: {}, ticketId: ticket.id, ticketCreatedAt: ticket.createdAt, },