[typeorm] softDelete / find

김민재·2024년 2월 13일

typeorm

목록 보기
1/8
post-thumbnail

typeorm은 find메서드 사용 시 deleted_ad이 null인 데이터만 찾아온다. (삭제를 안한 유저만)

  async find() {
    return await this.userRepository.find({
      select: ["id", "email", "name", "deletedAt", "nickName"],
      withDeleted: true // soft delete된 항목도 포함
    });
  }

withDeleted: true를 하게 되면 null이 아닌 유저도 찾아와준다.

profile
개발 경험치 쌓는 곳

0개의 댓글