Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WebBack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
websystem
WebBack
Commits
6e0ce3d0
Commit
6e0ce3d0
authored
4 months ago
by
tpgus2603
Browse files
Options
Downloads
Patches
Plain Diff
refactor : 컨트롤러 및 기타 주석 정리(
#22
)
parent
476327cd
Branches
Branches containing commit
No related tags found
2 merge requests
!42
[#25] 배포코드 master브랜치로 이동
,
!35
Refactor/#22
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
controllers/meetingController.js
+1
-1
1 addition, 1 deletion
controllers/meetingController.js
services/friendService.js
+18
-23
18 additions, 23 deletions
services/friendService.js
with
19 additions
and
24 deletions
controllers/meetingController.js
+
1
−
1
View file @
6e0ce3d0
...
@@ -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":
* }
* }
...
...
This diff is collapsed.
Click to expand it.
services/friendService.js
+
18
−
23
View file @
6e0ce3d0
...
@@ -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
({
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment