Skip to content

Commit

Permalink
🔨 fix(user) : user entity eagar 관련 옵션 끄기
Browse files Browse the repository at this point in the history
  • Loading branch information
ImNM committed Aug 6, 2022
1 parent e731a50 commit fd3f2c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/auth/guards/AccessToken.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class AccessTokenGuard implements CanActivate {
context: ExecutionContext
): boolean | Promise<boolean> | Observable<boolean> {
//@NoAuth 사용시 해당 부분에서 AccessTokenGuard 사용 해제시킴
const noAuth = this.reflector.get<boolean>('no-auth', context.getHandler())
const noAuth = this.reflector.get<boolean>('no-auth', context.getHandler());
if (noAuth) {
return true;
}
Expand Down Expand Up @@ -56,6 +56,7 @@ export class AccessTokenGuard implements CanActivate {

const payload = this.authService.verifyAccessJWT(jwtString);

// const user = payload
const user = await this.authService.findUserById(payload.id);
if (!user) {
throw new UnauthorizedException(
Expand Down
6 changes: 3 additions & 3 deletions src/database/entities/user.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,23 @@ export class User {
})
public role: Role;

@OneToMany(type => Comment, comment => comment.user, { eager: true })
@OneToMany(type => Comment, comment => comment.user, { eager: false })
public comments: Comment[];

@ApiProperty({
description: '유저의 주문목록',
type: () => [Order]
})
@Expose()
@OneToMany(type => Order, order => order.user, { eager: true })
@OneToMany(type => Order, order => order.user, { eager: false })
public order: Order[];

@ApiProperty({
description: '유저의 티켓목록',
type: () => [Ticket]
})
@Expose()
@OneToMany(type => Ticket, ticket => ticket.user, { eager: true })
@OneToMany(type => Ticket, ticket => ticket.user, { eager: false })
public ticket: Ticket[];

@ApiProperty({
Expand Down

0 comments on commit fd3f2c1

Please sign in to comment.