From 14b3d31384b7ea1c39fd0d3d7b04c12e1ad6550f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=EB=8C=80=ED=9D=AC?= <joedaehui@ajou.ac.kr> Date: Sat, 16 Nov 2024 11:49:47 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B9=9C=EA=B5=AC=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=20=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/friendController.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/controllers/friendController.js b/controllers/friendController.js index b278d1a..de0d7e0 100644 --- a/controllers/friendController.js +++ b/controllers/friendController.js @@ -149,7 +149,36 @@ class friendController { }); } } - + + /** + * 친구 삭제 + * DELETE /api/friend/:friendId + */ + async deleteFriend(req, res) { + try { + const userId = req.user.id; + const { friendId } = req.params; + + const result = await FriendService.deleteFriend(user, friendId); + + return res.status(200).json({ + success: true, + data: { + message: 'Friend deleted successfully', + data: result + } + }); + } catch (error) { + return res.status(400).json({ + success: false, + error: { + message: error.message, + code: 'FRIEND_DELETE_ERROR' + } + }); + } + } + } module.exports = new friendController(); \ No newline at end of file -- GitLab