Prisma object undefined on mutation
My schemas look like this and the mutation in question is
can't tell if i'm just being dumb or not
model Idea {
id String @id @default(cuid())
title String
description String
createdAt DateTime @default(now())
rating Int @default(0)
slug String @unique
ideaNotes IdeaNote[]
}
model IdeaNote {
id String @id @default(cuid())
createdAt DateTime @default(now())
text String
idea Idea @relation(fields: [ideaId], references: [id])
ideaId String
}model Idea {
id String @id @default(cuid())
title String
description String
createdAt DateTime @default(now())
rating Int @default(0)
slug String @unique
ideaNotes IdeaNote[]
}
model IdeaNote {
id String @id @default(cuid())
createdAt DateTime @default(now())
text String
idea Idea @relation(fields: [ideaId], references: [id])
ideaId String
} submitIdeaNote: t.procedure
.input(
z.object({
message: z.string(),
ideaId: z.string(),
})
)
.mutation(async ({ ctx, input }) => {
if (!input || !input.message) {
return { error: "Missing title or description" };
}
return await ctx.prisma.ideaNote.create({
data: {
text: input.message,
ideaId: input.ideaId,
},
});
}), submitIdeaNote: t.procedure
.input(
z.object({
message: z.string(),
ideaId: z.string(),
})
)
.mutation(async ({ ctx, input }) => {
if (!input || !input.message) {
return { error: "Missing title or description" };
}
return await ctx.prisma.ideaNote.create({
data: {
text: input.message,
ideaId: input.ideaId,
},
});
}),can't tell if i'm just being dumb or not
