createProfileSchema: publicProcedure
.input(createProfileSchema)
.mutation(async ({ ctx, input }) => {
try {
const session = await getSession({ ctx.session });
const { bio, profession, image, first_name, last_name, gender } = input;
return await ctx.prisma.profile.create({
data: {
bio,
profession,
image,
first_name,
last_name,
gender,
user: { connect: { email: session.data.user.email } },
},
});
} catch (error) {
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
cause: error,
});
}
}),
createProfileSchema: publicProcedure
.input(createProfileSchema)
.mutation(async ({ ctx, input }) => {
try {
const session = await getSession({ ctx.session });
const { bio, profession, image, first_name, last_name, gender } = input;
return await ctx.prisma.profile.create({
data: {
bio,
profession,
image,
first_name,
last_name,
gender,
user: { connect: { email: session.data.user.email } },
},
});
} catch (error) {
throw new TRPCError({
code: "INTERNAL_SERVER_ERROR",
cause: error,
});
}
}),