feat: file/screenshot attachments on support tickets (v0.49.1)
Support form now accepts up to 5 attachments (images, PDF, text, JSON, zip; 10MB each) via the existing S3/MinIO presigned-upload flow. New support_ticket_attachments table; attachment links get folded into the Gitea issue body and shown as thumbnails in both the user's ticket history and the admin support view. New presign endpoint (/api/v1/support/attachments/presign, rate-limited 20/hr) scoped to the uploading user rather than a ticket id, since the ticket doesn't exist yet at upload time. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { pgTable, text, timestamp, index, pgEnum } from "drizzle-orm/pg-core";
|
||||
import { pgTable, text, timestamp, integer, index, pgEnum } from "drizzle-orm/pg-core";
|
||||
import { relations } from "drizzle-orm";
|
||||
import { users } from "./users";
|
||||
|
||||
@@ -21,6 +21,22 @@ export const supportTickets = pgTable("support_tickets", {
|
||||
index("support_tickets_status_idx").on(t.status, t.createdAt),
|
||||
]);
|
||||
|
||||
export const supportTicketsRelations = relations(supportTickets, ({ one }) => ({
|
||||
export const supportTicketAttachments = pgTable("support_ticket_attachments", {
|
||||
id: text("id").primaryKey(),
|
||||
ticketId: text("ticket_id").notNull().references(() => supportTickets.id, { onDelete: "cascade" }),
|
||||
storageKey: text("storage_key").notNull(),
|
||||
contentType: text("content_type").notNull(),
|
||||
sizeBytes: integer("size_bytes").notNull(),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
}, (t) => [
|
||||
index("support_ticket_attachments_ticket_idx").on(t.ticketId),
|
||||
]);
|
||||
|
||||
export const supportTicketsRelations = relations(supportTickets, ({ one, many }) => ({
|
||||
user: one(users, { fields: [supportTickets.userId], references: [users.id] }),
|
||||
attachments: many(supportTicketAttachments),
|
||||
}));
|
||||
|
||||
export const supportTicketAttachmentsRelations = relations(supportTicketAttachments, ({ one }) => ({
|
||||
ticket: one(supportTickets, { fields: [supportTicketAttachments.ticketId], references: [supportTickets.id] }),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user