refactor(backend): 存在確認のfindOneByをexistに置き換え (#11224)
* refactor(backend): 存在確認の`findOneBy`を`exist`に置き換え * cleanup
This commit is contained in:
@@ -97,11 +97,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
if (me == null) {
|
||||
throw new ApiError(meta.errors.forbidden);
|
||||
} else if (me.id !== user.id) {
|
||||
const following = await this.followingsRepository.findOneBy({
|
||||
followeeId: user.id,
|
||||
followerId: me.id,
|
||||
const isFollowing = await this.followingsRepository.exist({
|
||||
where: {
|
||||
followeeId: user.id,
|
||||
followerId: me.id,
|
||||
},
|
||||
});
|
||||
if (following == null) {
|
||||
if (!isFollowing) {
|
||||
throw new ApiError(meta.errors.forbidden);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user