From 3f91cdc769be38767c54f62e10dfdd7c5ba88002 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:31:33 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B9=9C=EA=B5=AC=20=EC=9A=94=EC=B2=AD?= =?UTF-8?q?=20=EB=B3=B4=EB=82=B4=EA=B8=B0=20=EC=BB=A8=ED=8A=B8=EB=A1=A4?= =?UTF-8?q?=EB=9F=AC=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/friendController.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/controllers/friendController.js b/controllers/friendController.js index e69de29..fdd0130 100644 --- a/controllers/friendController.js +++ b/controllers/friendController.js @@ -0,0 +1,30 @@ +const FriendService = require('../services/friendService'); + +class friendController { + /** + * 친구 요청 보내기 + * POST /api/friend/request + */ + async sendRequest(req, res) { + try { + const userId = req.user.id; + const { friendId } = req.body; + + const request = await FriendService.sendFriendRequest(userId, friendId); + return res.status(201).json({ + success: true, + data: request + }); + } catch (error) { + return res.status(400).json({ + success: false, + error: { + message: error.message, + code: 'FRIEND_REQUEST_ERROR' + } + }); + } + } +} + +module.exports = new friendController(); \ No newline at end of file -- GitLab