'EntityRepository' is deprecated.
typeorm 0.3.x 버전부터는 기존에 사용하던 @EntityRepository가 사용할 수 없게 되었다.
auth.service
@Injectable()
export class AuthService {
constructor(
@InjectRepository(UserRepository)
private UserRepository: UserRepository
){}
user.repository
@Injectable()
export class UserRepository extends Repository<User> {
constructor(dataSource: DataSource) {
super(User, dataSource.createEntityManager());
}
auth.module
@Module({
imports:[
TypeOrmModule.forFeature([User])
],
controllers: [AuthController],
providers: [AuthService, UserRepository]
})
export class AuthModule {}
참조 : https://velog.io/@sheoae12/NestJS-Custom-Repository-%EB%A7%8C%EB%93%A4%EA%B8%B0