Skip to content

Commit

Permalink
fix(infra): change instance type and make transaction signup code
Browse files Browse the repository at this point in the history
  • Loading branch information
goathoon committed May 18, 2024
1 parent ecb2194 commit e0abfd6
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions apps/backend/apps/client/src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,35 @@ export class UserService {
// pass
}

const user: User = await this.createUser(newSignUpDto)
const CreateUserProfileData: CreateUserProfileData = {
userId: user.id,
realName: signUpDto.realName
}
await this.createUserProfile(CreateUserProfileData)
await this.registerUserToPublicGroup(user.id)
const returnUser: User = await this.prisma.$transaction(async (prisma) => {
const user = await prisma.user.create({
data: {
username: signUpDto.username,
password: newSignUpDto.password,
email: signUpDto.email
}
})

return user
await prisma.userProfile.create({
data: {
realName: signUpDto.realName,
user: {
connect: { id: user.id }
}
}
})

await prisma.userGroup.create({
data: {
userId: user.id,
groupId: 1,
isGroupLeader: false
}
})
return user
})

return returnUser
}

async signUp(req: Request, signUpDto: SignUpDto) {
Expand Down

0 comments on commit e0abfd6

Please sign in to comment.