Skip to content

Commit

Permalink
fix: review feedback fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts authored and 0-vortex committed Sep 28, 2022
1 parent aef9df6 commit f3808a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
16 changes: 4 additions & 12 deletions src/auth/auth.controller.ts
Expand Up @@ -2,7 +2,7 @@ import { Controller, Get, HttpCode, HttpStatus, Post, UseGuards } from "@nestjs/
import { ApiBearerAuth, ApiOkResponse, ApiOperation, ApiTags } from "@nestjs/swagger";
import { SupabaseGuard } from "./supabase.guard";
import { SupabaseAuthUser } from "nestjs-supabase-auth";
import { User } from "./supabase.user.decorator";
import { User, UserId } from "./supabase.user.decorator";
import { SupabaseAuthDto } from "./dtos/supabase-auth-response.dto";
import { UserService } from "../user/user.service";

Expand Down Expand Up @@ -87,16 +87,8 @@ export class AuthController {
})
@ApiOkResponse({ type: SupabaseAuthDto })
async postWaitlist (
@User() user: SupabaseAuthUser,
): Promise<SupabaseAuthDto> {
const { user_metadata: { sub: id } } = user;

try {
await this.userService.updateWaitlistStatus(id as number);
} catch (e) {
// handle error
}

return user;
@UserId() userId: number,
): Promise<void> {
return this.userService.updateWaitlistStatus(userId);
}
}
4 changes: 2 additions & 2 deletions src/user/user.service.ts
Expand Up @@ -65,7 +65,7 @@ export class UserService {

await this.userRepository.update(id, { is_onboarded: true, is_waitlisted: false });
} catch (e) {
// handle error
throw new Error("Unable to update user onboarding status");
}
}

Expand All @@ -75,7 +75,7 @@ export class UserService {

await this.userRepository.update(id, { is_waitlisted: true });
} catch (e) {
// handle error
throw new Error("Unable to update user waitlist status");
}
}
}

0 comments on commit f3808a5

Please sign in to comment.