Create new table and create a record problem #16201
Unanswered
abdallahmalkawi-94
asked this question in
Self-Hosting
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I created a new table called product and also created the index and create page, but when fill in the fields and submit the form I get the error:
Something went wrong TypeError: Cannot read properties of undefined (reading 'create')
the createHandler:
import { WEBAPP_URL } from "@calcom/lib/constants";
import { prisma } from "@calcom/prisma";
import type { TrpcSessionUser } from "../../../trpc";
import type { TCreateInputSchema } from "./create.schema";
type CreateOptions = {
ctx: {
user: NonNullable;
};
input: TCreateInputSchema;
};
export const createHandler = async ({ ctx, input }: CreateOptions) => {
const { user } = ctx;
const { name, adminName, adminEmail } = input;
const createdProduct = await prisma.product.create({
data: {
name,
adminName,
adminEmail,
},
});
return {
url:
${WEBAPP_URL}/products
,message:
The product ${name} has been created successfully
,team: createdProduct,
};
};
export default createHandler;
when using another table it is working without any problem.
can anyone help me?
Beta Was this translation helpful? Give feedback.
All reactions