Skip to content

Commit

Permalink
debug: signup
Browse files Browse the repository at this point in the history
  • Loading branch information
kyeahxx19 committed Feb 8, 2024
1 parent 53c7be1 commit e51b149
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,10 @@ export class AuthController {
}

const pageName = Object.keys(Page).find((key) => Page[key] == page);
console.log(Page[page]);
if (info[pageName] == undefined || info[pageName] == null)
throw new BadRequestException('invalid info');
switch (pageName) {
case 'userName':
await this.userService.updateUser(id, 'userName', info['userName']);
break;
default:
await this.userService.updateUserInfo(infoId, pageName, info[pageName]);
}
Expand Down Expand Up @@ -133,6 +131,7 @@ export class AuthController {
): Promise<SignupTokenResponseDto> {
const { id, page } = signupPayload;
if (Page[page] != 'phoneNumber') {
console.log(Page[page]);
throw new BadRequestException('invalid signup token');
}
await this.authService.validatePhoneNumber(body.phoneNumber, id);
Expand All @@ -148,8 +147,8 @@ export class AuthController {
@SignupUser() signupPayload: SignupPayload,
@Body() body: SignupImageRequestDto,
): Promise<SignupTokenResponseDto> {
const { id } = signupPayload;

const { id, page } = signupPayload;
console.log(Page[page]);
await this.userService.updateUserImages(id, body.images);
const signupToken = this.authService.getSignupToken(signupPayload);
return { signupToken };
Expand All @@ -164,6 +163,7 @@ export class AuthController {
): Promise<SignupTokenResponseDto> {
const { id, page } = signupPayload;
if (Page[page] != 'email') {
console.log(Page[page]);
throw new BadRequestException('invalid signup token');
}
await this.authService.sendVerificationCode(id, body.email);
Expand Down
21 changes: 11 additions & 10 deletions src/blurting/blurting.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,16 +352,6 @@ export class BlurtingService {
async registerGroupQueue(id: number) {
try {
const user = await this.userService.findUserByVal('id', id);
if (
user.group &&
user.group.createdAt <
new Date(new Date().getTime() - 1000 * 60 * 60 * 63)
) {
return 3;
}
if (user.group) {
return 1;
}
const sexOrient = this.userService.getUserSexOrient(user.userInfo);
//const region = user.userInfo.region.split(' ')[0];
const qName = /*`${region}_*/ `${sexOrient}`;
Expand All @@ -375,6 +365,17 @@ export class BlurtingService {
return 2;
}

if (
user.group &&
user.group.createdAt <
new Date(new Date().getTime() - 1000 * 60 * 60 * 63)
) {
return 3;
}
if (user.group) {
return 1;
}

if (groupQueue.length < 2) {
groupQueue.push(id);
await this.cacheManager.set(qName, groupQueue);
Expand Down

0 comments on commit e51b149

Please sign in to comment.