Prisma object undefined on mutation

My schemas look like this
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
}
and the mutation in question is
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
1 Reply
jack
jack3y ago
for some reason, ideaNote is undefined linting seems to have no issue with it being a property of prisma which leads to my confusion
Want results from more Discord servers?
Add your server