Skip to content
Snippets Groups Projects
Commit 6e0ce3d0 authored by tpgus2603's avatar tpgus2603
Browse files

refactor : 컨트롤러 및 기타 주석 정리(#22)

parent 476327cd
Branches
No related tags found
2 merge requests!42[#25] 배포코드 master브랜치로 이동,!35Refactor/#22
...@@ -14,7 +14,7 @@ class MeetingController { ...@@ -14,7 +14,7 @@ class MeetingController {
* "time_idx_start": 40, // 예: 10:00 AM * "time_idx_start": 40, // 예: 10:00 AM
* "time_idx_end": 42, // 예: 10:30 AM * "time_idx_end": 42, // 예: 10:30 AM
* "location": "회의실 A", * "location": "회의실 A",
* "deadline": "2024-04-25T23:59:59Z", * "deadline": "43",
* "type": "OPEN" // "OPEN" 또는 "CLOSE" * "type": "OPEN" // "OPEN" 또는 "CLOSE"
* "max_num": * "max_num":
* } * }
......
...@@ -11,9 +11,7 @@ const FriendListDTO = require('../dtos/FriendListDTO'); ...@@ -11,9 +11,7 @@ const FriendListDTO = require('../dtos/FriendListDTO');
class FriendService { class FriendService {
/** /**
* User 존재 여부 유효성 검사 * User 존재 여부 유효성 검사
* @param {number} userId - 검사할 사용자 ID * userId - 검사할 사용자 ID
* @returns {Promise<User>} - 유효한 사용자 객체
* @throws {Error} - 사용자가 존재하지 않을 경우
*/ */
async validUser(userId) { async validUser(userId) {
const user = await User.findByPk(userId); const user = await User.findByPk(userId);
...@@ -25,10 +23,9 @@ class FriendService { ...@@ -25,10 +23,9 @@ class FriendService {
/** /**
* 친구 요청 보내기 * 친구 요청 보내기
* @param {number} userId - 친구 요청을 보내는 사용자 ID * userId - 친구 요청을 보내는 사용자 ID
* @param {number} friendId - 친구 요청을 받는 사용자 ID * friendId - 친구 요청을 받는 사용자 ID
* @returns {Promise<FriendResponseDTO>} - 생성된 친구 요청 DTO * returns - 생성된 친구 요청 DTO
* @throws {Error} - 유효하지 않은 요청일 경우
*/ */
async sendFriendRequest(userId, friendId) { async sendFriendRequest(userId, friendId) {
await this.validUser(userId); await this.validUser(userId);
...@@ -81,8 +78,8 @@ class FriendService { ...@@ -81,8 +78,8 @@ class FriendService {
/** /**
* 받은 친구 요청 목록 조회 * 받은 친구 요청 목록 조회
* @param {number} userId - 요청을 받은 사용자 ID userId - 요청을 받은 사용자 ID
* @returns {Promise<Array<FriendResponseDTO>>} - 받은 친구 요청 목록 DTO 배열 받은 친구 요청 목록 DTO 배열
*/ */
async getReceivedRequests(userId) { async getReceivedRequests(userId) {
const receivedRequests = await Friend.findAll({ const receivedRequests = await Friend.findAll({
...@@ -101,8 +98,7 @@ class FriendService { ...@@ -101,8 +98,7 @@ class FriendService {
/** /**
* 보낸 친구 요청 목록 조회 * 보낸 친구 요청 목록 조회
* @param {number} userId - 요청을 보낸 사용자 ID * userId - 요청을 보낸 사용자 ID
* @returns {Promise<Array<FriendResponseDTO>>} - 보낸 친구 요청 목록 DTO 배열
*/ */
async getSentRequests(userId) { async getSentRequests(userId) {
const sentRequests = await Friend.findAll({ const sentRequests = await Friend.findAll({
...@@ -163,10 +159,9 @@ class FriendService { ...@@ -163,10 +159,9 @@ class FriendService {
/** /**
* 친구 요청 거절 * 친구 요청 거절
* @param {number} userId - 요청을 거절하는 사용자 ID *userId - 요청을 거절하는 사용자 ID
* @param {number} friendId - 친구 요청을 보낸 사용자 ID * friendId - 친구 요청을 보낸 사용자 ID
* @returns {Promise<number>} - 삭제된 친구 요청 수 * returns - 삭제된 친구 요청 수
* @throws {Error} - 친구 요청이 존재하지 않을 경우
*/ */
async rejectFriendRequest(userId, friendId) { async rejectFriendRequest(userId, friendId) {
const result = await Friend.destroy({ const result = await Friend.destroy({
...@@ -186,10 +181,10 @@ class FriendService { ...@@ -186,10 +181,10 @@ class FriendService {
/** /**
* 친구 목록 조회 * 친구 목록 조회
* @param {number} userId - 친구 목록을 조회할 사용자 ID userId - 친구 목록을 조회할 사용자 ID
* @param {number} limit - 한 페이지에 표시할 친구 수 limit - 한 페이지에 표시할 친구 수
* @param {number} offset - 페이징 오프셋 offset - 페이징 오프셋
* @returns {Promise<Array<FriendListDTO>>} - 친구 목록 DTO 배열 친구 목록 DTO 배열
*/ */
async getFriendList(userId, pagination) { async getFriendList(userId, pagination) {
const { limit = 20, offset = 0 } = pagination; const { limit = 20, offset = 0 } = pagination;
...@@ -232,10 +227,10 @@ class FriendService { ...@@ -232,10 +227,10 @@ class FriendService {
/** /**
* 친구 삭제 * 친구 삭제
* @param {number} userId - 친구를 삭제하는 사용자 ID - 친구를 삭제하는 사용자 ID
* @param {number} friendId - 삭제할 친구의 사용자 ID - 삭제할 친구의 사용자 ID
* @returns {Promise<number>} - 삭제된 친구 관계 수 - 삭제된 친구 관계 수
* @throws {Error} - 친구 관계가 존재하지 않을 경우 -친구 관계가 존재하지 않을 경우
*/ */
async deleteFriend(userId, friendId) { async deleteFriend(userId, friendId) {
const result = await Friend.destroy({ const result = await Friend.destroy({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment