Change ticket IDs from UUID to sequential integers
Backend: - tickets.id: uuid → integer GENERATED ALWAYS AS IDENTITY - transactions.ticket_id, custom_field_values.ticket_id: uuid → integer - Routes convert string params to Number() for DB queries - ScripEngine.prepare takes ticketId: number - ActionPayload.ticketId: string → number Frontend: - Ticket.id: string → number, Transaction.ticket_id: string → number - API functions accept number params - formatTicketId() helper returns TKT-0001 format - Ticket rows display TKT-XXXX, detail page uses formatTicketId Migration: drops FKs, clears data, alters column types, re-adds FKs
This commit is contained in:
@@ -15,7 +15,7 @@ import {
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
} from "@/components/ui/dialog";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { cn, formatTicketId } from "@/lib/utils";
|
||||
|
||||
const STATUS_COLORS: Record<string, string> = {
|
||||
new: "#8a8f98",
|
||||
@@ -38,7 +38,7 @@ type FilterKey = (typeof FILTERS)[number]["key"];
|
||||
|
||||
function TicketRow({ ticket, onClick }: { ticket: Ticket; onClick: () => void }) {
|
||||
const statusColor = STATUS_COLORS[ticket.status] || STATUS_COLORS.new;
|
||||
const shortId = ticket.id.slice(0, 8);
|
||||
const shortId = formatTicketId(ticket.id);
|
||||
const timeAgo = formatDistanceToNow(new Date(ticket.updated_at), { addSuffix: true });
|
||||
|
||||
return (
|
||||
|
||||
@@ -20,7 +20,7 @@ import type {
|
||||
UpdateResult,
|
||||
} from "@/lib/types";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { cn, formatTicketId } from "@/lib/utils";
|
||||
|
||||
const STATUS_COLORS: Record<string, string> = {
|
||||
new: "#8a8f98",
|
||||
@@ -151,7 +151,8 @@ export default function TicketDetailPage({
|
||||
}: {
|
||||
params: Promise<{ id: string }>;
|
||||
}) {
|
||||
const { id } = use(params);
|
||||
const { id: idParam } = use(params);
|
||||
const id = Number(idParam);
|
||||
const router = useRouter();
|
||||
|
||||
const [ticket, setTicket] = useState<Ticket | null>(null);
|
||||
@@ -328,7 +329,7 @@ export default function TicketDetailPage({
|
||||
{ticket.subject}
|
||||
</h1>
|
||||
<p className="text-xs text-muted-foreground mt-0.5">
|
||||
<span className="font-mono">{ticket.id.slice(0, 8)}</span> · {queue?.name || ticket.queue_id}
|
||||
<span className="font-mono">{formatTicketId(ticket.id)}</span> · {queue?.name || ticket.queue_id}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user