refactor(backend): 存在確認のfindOneBy
をexist
に置き換え (#11224)
* refactor(backend): 存在確認の`findOneBy`を`exist`に置き換え * cleanup
This commit is contained in:
parent
48d3341462
commit
cf3e39178b
42 changed files with 287 additions and 200 deletions
|
@ -217,11 +217,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
|
||||
// Check blocking
|
||||
if (renote.userId !== me.id) {
|
||||
const block = await this.blockingsRepository.findOneBy({
|
||||
blockerId: renote.userId,
|
||||
blockeeId: me.id,
|
||||
const blockExist = await this.blockingsRepository.exist({
|
||||
where: {
|
||||
blockerId: renote.userId,
|
||||
blockeeId: me.id,
|
||||
},
|
||||
});
|
||||
if (block) {
|
||||
if (blockExist) {
|
||||
throw new ApiError(meta.errors.youHaveBeenBlocked);
|
||||
}
|
||||
}
|
||||
|
@ -240,11 +242,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|||
|
||||
// Check blocking
|
||||
if (reply.userId !== me.id) {
|
||||
const block = await this.blockingsRepository.findOneBy({
|
||||
blockerId: reply.userId,
|
||||
blockeeId: me.id,
|
||||
const blockExist = await this.blockingsRepository.exist({
|
||||
where: {
|
||||
blockerId: reply.userId,
|
||||
blockeeId: me.id,
|
||||
},
|
||||
});
|
||||
if (block) {
|
||||
if (blockExist) {
|
||||
throw new ApiError(meta.errors.youHaveBeenBlocked);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue