강의

멘토링

커뮤니티

인프런 커뮤니티 질문&답변

Cliche님의 프로필 이미지
Cliche

작성한 질문수

Slack 클론 코딩[백엔드 with NestJS + TypeORM]

local serializer, guard

deserializerUser 질문

작성

·

296

0

local.serializer.ts 에서

async deserializeUser(userId: string, done: CallableFunction) {
    return await this.usersRepository
      .findOneOrFail(
        {
          id: +userId,
        },
        {
          select: ['id', 'email', 'nickname'],
          relations: ['Workspaces'], //relation 을 사용해도 되지만 join 을 사용해도 가능함!!
        },
      )
      .then((user: Users) => {
        console.log('user', user);
        done(null, user); //user 가 req.user
      })
      .catch((error) => done(error));
  }

부분중

  {
          select: ['id', 'email', 'nickname'],
          relations: ['Workspaces'], //relation 을 사용해도 되지만 join 을 사용해도 가능함!!
        },

에러를 나타 냅니다에러의 내용은 1개의 인수가 필요한데 2개를 가져왔다고 합니다.

이부분에서의 인수를 받아오는 곳을 아무리 봐도 찾을 수가 없어 질문을 드리게 되었습니다.

코드에서의 이부분은 어느곳에서 인수를 받아 오게 되는지요?

또한 해결을 하려면 어느부분을 봐야 할까요?

답변 2

0

Cliche님의 프로필 이미지
Cliche
질문자

보고 해결되었습니다 감사합니다!

0

제로초(조현영)님의 프로필 이미지
제로초(조현영)
지식공유자

typeorm 버전 몇을 사용하시나요? package.json에서 확인하세요.

Cliche님의 프로필 이미지
Cliche
질문자

0.3.10 입니다.

Cliche님의 프로필 이미지
Cliche

작성한 질문수

질문하기