feat: align ticket header editing flow
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
parent
e833888a3a
commit
f5a54f2814
21 changed files with 282 additions and 171 deletions
|
|
@ -1,9 +1,7 @@
|
|||
import { internalMutation, mutation, query } from "./_generated/server";
|
||||
import { mutation, query } from "./_generated/server";
|
||||
import { ConvexError, v } from "convex/values";
|
||||
import { Id, type Doc } from "./_generated/dataModel";
|
||||
|
||||
const PRIORITY_ORDER = ["URGENT", "HIGH", "MEDIUM", "LOW"] as const;
|
||||
|
||||
const QUEUE_RENAME_LOOKUP: Record<string, string> = {
|
||||
"Suporte N1": "Chamados",
|
||||
"suporte-n1": "Chamados",
|
||||
|
|
@ -768,6 +766,7 @@ export const playNext = mutation({
|
|||
const requester = (await ctx.db.get(chosen.requesterId)) as Doc<"users"> | null
|
||||
const assignee = chosen.assigneeId ? ((await ctx.db.get(chosen.assigneeId)) as Doc<"users"> | null) : null
|
||||
const queue = chosen.queueId ? ((await ctx.db.get(chosen.queueId)) as Doc<"queues"> | null) : null
|
||||
const queueName = normalizeQueueName(queue)
|
||||
return {
|
||||
id: chosen._id,
|
||||
reference: chosen.reference,
|
||||
|
|
@ -777,13 +776,13 @@ export const playNext = mutation({
|
|||
status: chosen.status,
|
||||
priority: chosen.priority,
|
||||
channel: chosen.channel,
|
||||
queue: queue?.name ?? null,
|
||||
queue: queueName,
|
||||
requester: requester && {
|
||||
id: requester._id,
|
||||
name: requester.name,
|
||||
email: requester.email,
|
||||
avatarUrl: requester.avatarUrl,
|
||||
teams: requester.teams ?? [],
|
||||
teams: normalizeTeams(requester.teams),
|
||||
},
|
||||
assignee: assignee
|
||||
? {
|
||||
|
|
@ -791,7 +790,7 @@ export const playNext = mutation({
|
|||
name: assignee.name,
|
||||
email: assignee.email,
|
||||
avatarUrl: assignee.avatarUrl,
|
||||
teams: assignee.teams ?? [],
|
||||
teams: normalizeTeams(assignee.teams),
|
||||
}
|
||||
: null,
|
||||
slaPolicy: null,
|
||||
|
|
@ -808,8 +807,8 @@ export const playNext = mutation({
|
|||
});
|
||||
|
||||
export const remove = mutation({
|
||||
args: { ticketId: v.id("tickets"), actorId: v.id("users") },
|
||||
handler: async (ctx, { ticketId, actorId }) => {
|
||||
args: { ticketId: v.id("tickets") },
|
||||
handler: async (ctx, { ticketId }) => {
|
||||
// delete comments (and attachments)
|
||||
const comments = await ctx.db
|
||||
.query("ticketComments")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue