MCPcopy Create free account
hub / github.com/prisma/prisma-examples / signupUser

Method signupUser

orm/nest/src/app.controller.ts:82–102  ·  view source on GitHub ↗
(
    @Body()
    userData: {
      name?: string;
      email: string;
      posts?: Prisma.PostCreateInput[];
    },
  )

Source from the content-addressed store, hash-verified

80
81 @Post('signup')
82 async signupUser(
83 @Body()
84 userData: {
85 name?: string;
86 email: string;
87 posts?: Prisma.PostCreateInput[];
88 },
89 ): Promise<UserModel> {
90 const postData = userData.posts?.map((post) => {
91 return { title: post?.title, content: post?.content };
92 });
93 return this.prismaService.extendedPrismaClient().user.create({
94 data: {
95 name: userData?.name,
96 email: userData.email,
97 posts: {
98 create: postData,
99 },
100 },
101 });
102 }
103
104 @Put('publish/:id')
105 async togglePublishPost(@Param('id') id: string): Promise<PostModel> {

Callers 1

mainFunction · 0.45

Calls 1

extendedPrismaClientMethod · 0.80

Tested by

no test coverage detected