Compare commits

...

3 Commits

Author SHA1 Message Date
Henry
845e7e81c1 fix: slice title when longer than max chars during import 2025-12-29 22:19:28 +00:00
Henry
019411de3f feat: add input length validation 2025-12-29 22:06:55 +00:00
Henry
4d6ecb7d41 feat: update card title from varchar to text 2025-12-29 22:05:30 +00:00
6 changed files with 2992 additions and 7 deletions

View File

@@ -27,7 +27,7 @@ export const cardRouter = createTRPCRouter({
}) })
.input( .input(
z.object({ z.object({
title: z.string().min(1), title: z.string().min(1).max(2000),
description: z.string().max(10000), description: z.string().max(10000),
listPublicId: z.string().min(12), listPublicId: z.string().min(12),
labelPublicIds: z.array(z.string().min(12)), labelPublicIds: z.array(z.string().min(12)),
@@ -760,7 +760,7 @@ export const cardRouter = createTRPCRouter({
.input( .input(
z.object({ z.object({
cardPublicId: z.string().min(12), cardPublicId: z.string().min(12),
title: z.string().min(1).optional(), title: z.string().min(1).max(2000).optional(),
description: z.string().optional(), description: z.string().optional(),
index: z.number().optional(), index: z.number().optional(),
listPublicId: z.string().min(12).optional(), listPublicId: z.string().min(12).optional(),

View File

@@ -52,7 +52,7 @@ interface TrelloCheckItem {
interface TrelloCard { interface TrelloCard {
id: string; id: string;
name: string; name: string | null;
desc: string; desc: string;
idList: string; idList: string;
labels: TrelloLabel[]; labels: TrelloLabel[];
@@ -290,7 +290,7 @@ export const importRouter = createTRPCRouter({
if (list.cards.length && newListId) { if (list.cards.length && newListId) {
const cardsInsert = list.cards.map((card, index) => ({ const cardsInsert = list.cards.map((card, index) => ({
publicId: generateUID(), publicId: generateUID(),
title: card.name, title: (card.name?.trim() ?? "Untitled Card").slice(0, 2000),
description: card.description, description: card.description,
createdBy: userId, createdBy: userId,
listId: newListId, listId: newListId,

View File

@@ -0,0 +1,3 @@
ALTER TABLE "card_activity" ALTER COLUMN "fromTitle" SET DATA TYPE text;--> statement-breakpoint
ALTER TABLE "card_activity" ALTER COLUMN "toTitle" SET DATA TYPE text;--> statement-breakpoint
ALTER TABLE "card" ALTER COLUMN "title" SET DATA TYPE text;

File diff suppressed because it is too large Load Diff

View File

@@ -148,6 +148,13 @@
"when": 1764621815672, "when": 1764621815672,
"tag": "20251201204335_AddCardDueDates", "tag": "20251201204335_AddCardDueDates",
"breakpoints": true "breakpoints": true
},
{
"idx": 21,
"version": "7",
"when": 1767045713686,
"tag": "20251229220153_UpdateCardTitleFromVarcharToText",
"breakpoints": true
} }
] ]
} }

View File

@@ -57,7 +57,7 @@ export const activityTypeEnum = pgEnum("card_activity_type", activityTypes);
export const cards = pgTable("card", { export const cards = pgTable("card", {
id: bigserial("id", { mode: "number" }).primaryKey(), id: bigserial("id", { mode: "number" }).primaryKey(),
publicId: varchar("publicId", { length: 12 }).notNull().unique(), publicId: varchar("publicId", { length: 12 }).notNull().unique(),
title: varchar("title", { length: 255 }).notNull(), title: text("title").notNull(),
description: text("description"), description: text("description"),
index: integer("index").notNull(), index: integer("index").notNull(),
createdBy: uuid("createdBy").references(() => users.id, { createdBy: uuid("createdBy").references(() => users.id, {
@@ -127,8 +127,8 @@ export const cardActivities = pgTable("card_activity", {
workspaceMemberId: bigint("workspaceMemberId", { workspaceMemberId: bigint("workspaceMemberId", {
mode: "number", mode: "number",
}).references(() => workspaceMembers.id, { onDelete: "set null" }), }).references(() => workspaceMembers.id, { onDelete: "set null" }),
fromTitle: varchar("fromTitle", { length: 255 }), fromTitle: text("fromTitle"),
toTitle: varchar("toTitle", { length: 255 }), toTitle: text("toTitle"),
fromDescription: text("fromDescription"), fromDescription: text("fromDescription"),
toDescription: text("toDescription"), toDescription: text("toDescription"),
createdBy: uuid("createdBy").references(() => users.id, { createdBy: uuid("createdBy").references(() => users.id, {