From f10afb20632b0fdb6b239235642412711bf7656f Mon Sep 17 00:00:00 2001 From: Yunochi Date: Thu, 26 Dec 2024 16:38:44 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=EC=9E=90=EA=B8=B0=20=EC=9E=90?= =?UTF-8?q?=EC=8B=A0=EC=9D=84=20=EB=B8=94=EB=9D=BD=ED=95=A0=20=EC=88=98=20?= =?UTF-8?q?=EC=97=86=EB=8F=84=EB=A1=9D=20=EC=98=88=EC=99=B8=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/api/_service/blocking/blocking-service.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/api/_service/blocking/blocking-service.ts b/src/app/api/_service/blocking/blocking-service.ts index 3958e72..770b192 100644 --- a/src/app/api/_service/blocking/blocking-service.ts +++ b/src/app/api/_service/blocking/blocking-service.ts @@ -58,6 +58,9 @@ export class BlockingService { return sendApiError(400, 'Bad Request. User not found'); } try { + if (data.targetHandle === tokenBody?.handle) { + return sendApiError(400, '자기 자신을 블락할 수 없어요!'); + } const b = await this.createBlock(targetUser.handle, user.handle, false); this.logger.debug(`New Block created, hidden: ${b.hidden}, target: ${b.blockeeTarget}`); } catch (err) { @@ -87,6 +90,9 @@ export class BlockingService { if (q.questioneeHandle !== tokenBody?.handle) { return sendApiError(403, 'Not your question!'); } + if (q.questioneeHandle === tokenBody.handle) { + return sendApiError(400, '자기 자신을 블락할 수 없어요!'); + } if (q.questioner) { const b = await this.createBlock(q.questioner, tokenBody.handle, false, q.isAnonymous); this.logger.debug(`New Block created by Question ${q.id}, hidden: ${b.hidden}, target: ${b.blockeeTarget}`);