refactor(backend): 存在確認のfindOneByexistに置き換え (#11224)

* refactor(backend): 存在確認の`findOneBy`を`exist`に置き換え

* cleanup
This commit is contained in:
okayurisotto 2023-07-11 14:58:58 +09:00 committed by GitHub
parent 48d3341462
commit cf3e39178b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 287 additions and 200 deletions

View file

@ -106,16 +106,14 @@ export class NoteEntityService implements OnModuleInit {
hide = false;
} else {
// フォロワーかどうか
const following = await this.followingsRepository.findOneBy({
followeeId: packedNote.userId,
followerId: meId,
const isFollowing = await this.followingsRepository.exist({
where: {
followeeId: packedNote.userId,
followerId: meId,
},
});
if (following == null) {
hide = true;
} else {
hide = false;
}
hide = !isFollowing;
}
}