My schema looks like this:
boards: defineTable({
title: v.string(),
users: v.array(v.id("users")),
columns: v.array(v.id("columns")),
}),
columns: defineTable({
title: v.string(),
tasks: v.array(v.id("tasks")),
}),
My createColumn mutation:
export const createColumn = mutation({
args: zodToConvex(CreateColumnSchema),
handler: async (ctx, args) => {
const newColumnId = await ctx.db.insert("columns", { title: args.title, tasks: [] });
// WIP: Update the respective board's columns
return newColumnId;
},
});
The Zod schema looks like this:
export const CreateColumnSchema = z.object({
id: z.string(), // id of the board
title: z.string().min(1, { message: "Title is required." }).max(32, {
message: "Title is too long.",
}),
});
I would like to push the id of the new column to the respective board document. How can I do this?