You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to this.userRepository.findOne(userId) where userId is null, return the first user instead of throwing an error, it doesn't help detecting that the user does not exist.
I recommend using this.userRepository.findOne({ where: { id: userId } });
See this TypeORM issues: typeorm/typeorm#2500
The text was updated successfully, but these errors were encountered:
While playing with nestjs realworld, I found out that you can create post without user authenticated due to misspelled
aticles
inarticle.module.ts
https://github.com/lujakob/nestjs-realworld-example-app/blob/master/src/article/article.module.ts#L24-L27Due to
this.userRepository.findOne(userId)
where userId is null, return the first user instead of throwing an error, it doesn't help detecting that the user does not exist.I recommend using
this.userRepository.findOne({ where: { id: userId } });
See this TypeORM issues: typeorm/typeorm#2500
The text was updated successfully, but these errors were encountered: