Skip to content

Commit

Permalink
fix: exclude page complete in signup
Browse files Browse the repository at this point in the history
  • Loading branch information
kyeahxx19 committed Jul 6, 2024
1 parent 2b5597d commit 5a9282b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/common/enums/page.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ export enum Page {
hobby = 14,
images = 15,
job = 16,
complete = 17,
}
27 changes: 14 additions & 13 deletions src/domain/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,6 @@ export class AuthController {
@Body() info: SignupUserRequestDto,
) {
const { id, infoId, page } = signupPayload;
if (page == 17) {
const result = await this.authService.checkComplete(id);
if (!result) throw new BadRequestException('invalid info');

const nickname = await this.userService.pickRandomNickname();
await this.userService.updateUser(id, 'userNickname', nickname);
await this.userService.createSocketUser(id);
return {
refreshToken: await this.authService.getRefreshToken(id),
accessToken: this.authService.getAccessToken(id),
userId: id,
};
}

const pageName = Object.keys(Page).find((key) => Page[key] == page);

Expand All @@ -97,6 +84,20 @@ export class AuthController {
case 'birth':
await this.userService.updateUser(id, 'birth', info['birth']);
break;
case 'job':
await this.userService.updateUserInfo(infoId, pageName, info[pageName]);

const result = await this.authService.checkComplete(id);
if (!result) throw new BadRequestException('invalid info');

const nickname = await this.userService.pickRandomNickname();
await this.userService.updateUser(id, 'userNickname', nickname);
await this.userService.createSocketUser(id);
return {
refreshToken: await this.authService.getRefreshToken(id),
accessToken: this.authService.getAccessToken(id),
userId: id,
};
default:
await this.userService.updateUserInfo(infoId, pageName, info[pageName]);
}
Expand Down

0 comments on commit 5a9282b

Please sign in to comment.