refactor: quality workflow, docs, tests
This commit is contained in:
parent
a9caf36b01
commit
68ace0a858
27 changed files with 758 additions and 330 deletions
|
|
@ -347,7 +347,7 @@ export const list = query({
|
|||
priority: t.priority,
|
||||
channel: t.channel,
|
||||
queue: queueName,
|
||||
company: company ? { id: company._id, name: company.name, isAvulso: (company as any).isAvulso ?? false } : null,
|
||||
company: company ? { id: company._id, name: company.name, isAvulso: company.isAvulso ?? false } : null,
|
||||
requester: requester && {
|
||||
id: requester._id,
|
||||
name: requester.name,
|
||||
|
|
@ -377,14 +377,14 @@ export const list = query({
|
|||
subcategory: subcategorySummary,
|
||||
workSummary: {
|
||||
totalWorkedMs: t.totalWorkedMs ?? 0,
|
||||
internalWorkedMs: (t as any).internalWorkedMs ?? 0,
|
||||
externalWorkedMs: (t as any).externalWorkedMs ?? 0,
|
||||
internalWorkedMs: t.internalWorkedMs ?? 0,
|
||||
externalWorkedMs: t.externalWorkedMs ?? 0,
|
||||
activeSession: activeSession
|
||||
? {
|
||||
id: activeSession._id,
|
||||
agentId: activeSession.agentId,
|
||||
startedAt: activeSession.startedAt,
|
||||
workType: (activeSession as any).workType ?? "INTERNAL",
|
||||
workType: activeSession.workType ?? "INTERNAL",
|
||||
}
|
||||
: null,
|
||||
},
|
||||
|
|
@ -525,7 +525,7 @@ export const getById = query({
|
|||
priority: t.priority,
|
||||
channel: t.channel,
|
||||
queue: queueName,
|
||||
company: company ? { id: company._id, name: company.name, isAvulso: (company as any).isAvulso ?? false } : null,
|
||||
company: company ? { id: company._id, name: company.name, isAvulso: company.isAvulso ?? false } : null,
|
||||
requester: requester && {
|
||||
id: requester._id,
|
||||
name: requester.name,
|
||||
|
|
@ -566,14 +566,14 @@ export const getById = query({
|
|||
: null,
|
||||
workSummary: {
|
||||
totalWorkedMs: t.totalWorkedMs ?? 0,
|
||||
internalWorkedMs: (t as any).internalWorkedMs ?? 0,
|
||||
externalWorkedMs: (t as any).externalWorkedMs ?? 0,
|
||||
internalWorkedMs: t.internalWorkedMs ?? 0,
|
||||
externalWorkedMs: t.externalWorkedMs ?? 0,
|
||||
activeSession: activeSession
|
||||
? {
|
||||
id: activeSession._id,
|
||||
agentId: activeSession.agentId,
|
||||
startedAt: activeSession.startedAt,
|
||||
workType: (activeSession as any).workType ?? "INTERNAL",
|
||||
workType: activeSession.workType ?? "INTERNAL",
|
||||
}
|
||||
: null,
|
||||
},
|
||||
|
|
@ -1130,14 +1130,14 @@ export const workSummary = query({
|
|||
return {
|
||||
ticketId,
|
||||
totalWorkedMs: ticket.totalWorkedMs ?? 0,
|
||||
internalWorkedMs: (ticket as any).internalWorkedMs ?? 0,
|
||||
externalWorkedMs: (ticket as any).externalWorkedMs ?? 0,
|
||||
internalWorkedMs: ticket.internalWorkedMs ?? 0,
|
||||
externalWorkedMs: ticket.externalWorkedMs ?? 0,
|
||||
activeSession: activeSession
|
||||
? {
|
||||
id: activeSession._id,
|
||||
agentId: activeSession.agentId,
|
||||
startedAt: activeSession.startedAt,
|
||||
workType: (activeSession as any).workType ?? "INTERNAL",
|
||||
workType: activeSession.workType ?? "INTERNAL",
|
||||
}
|
||||
: null,
|
||||
}
|
||||
|
|
@ -1275,7 +1275,7 @@ export const pauseWork = mutation({
|
|||
pauseNote: note ?? "",
|
||||
})
|
||||
|
||||
const sessionType = ((session as any).workType ?? "INTERNAL").toUpperCase()
|
||||
const sessionType = (session.workType ?? "INTERNAL").toUpperCase()
|
||||
const deltaInternal = sessionType === "INTERNAL" ? durationMs : 0
|
||||
const deltaExternal = sessionType === "EXTERNAL" ? durationMs : 0
|
||||
|
||||
|
|
@ -1283,8 +1283,8 @@ export const pauseWork = mutation({
|
|||
working: false,
|
||||
activeSessionId: undefined,
|
||||
totalWorkedMs: (ticket.totalWorkedMs ?? 0) + durationMs,
|
||||
internalWorkedMs: ((ticket as any).internalWorkedMs ?? 0) + deltaInternal,
|
||||
externalWorkedMs: ((ticket as any).externalWorkedMs ?? 0) + deltaExternal,
|
||||
internalWorkedMs: (ticket.internalWorkedMs ?? 0) + deltaInternal,
|
||||
externalWorkedMs: (ticket.externalWorkedMs ?? 0) + deltaExternal,
|
||||
updatedAt: now,
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue