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
67c2a54b
Commit
67c2a54b
authored
3 months ago
by
조대희
Browse files
Options
Downloads
Patches
Plain Diff
bugfix: 미팅 조회 코드 수정
parent
e6169bf9
No related branches found
Branches containing commit
No related tags found
1 merge request
!42
[#25] 배포코드 master브랜치로 이동
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
services/meetingService.js
+26
-54
26 additions, 54 deletions
services/meetingService.js
with
26 additions
and
54 deletions
services/meetingService.js
+
26
−
54
View file @
67c2a54b
...
...
@@ -322,16 +322,9 @@ class MeetingService {
'
time_idx_start
'
,
'
time_idx_end
'
,
'
location
'
,
'
time_idx_deadline
'
,
'
type
'
,
'
max_num
'
,
'
cur_num
'
,
'
created_at
'
'
created_at
'
],
include
:
[
{
model
:
MeetingParticipant
,
as
:
'
participants
'
,
required
:
false
,
where
:
{
user_id
:
userId
},
attributes
:
[]
},
{
model
:
User
,
as
:
'
creator
'
,
...
...
@@ -339,14 +332,6 @@ class MeetingService {
required
:
false
}
],
where
:
{
[
Op
.
or
]:
[
{
created_by
:
userId
},
{
'
$participants.meeting_id$
'
:
{
[
Op
.
col
]:
'
Meeting.id
'
}
},
{
'
$participants.user_id$
'
:
userId
}
]
},
subQuery
:
false
,
order
:
[[
'
created_at
'
,
'
DESC
'
]],
limit
:
limit
+
1
,
offset
,
...
...
@@ -356,7 +341,13 @@ class MeetingService {
const
hasNext
=
meetings
.
length
>
limit
;
const
content
=
await
Promise
.
all
(
meetings
.
slice
(
0
,
limit
).
map
(
async
(
meeting
)
=>
{
const
isParticipant
=
true
;
const
isParticipant
=
await
MeetingParticipant
.
findOne
({
where
:
{
meeting_id
:
meeting
.
id
,
user_id
:
userId
}
});
const
hasConflict
=
await
ScheduleService
.
checkScheduleOverlapByTime
(
userId
,
meeting
.
time_idx_start
,
...
...
@@ -365,7 +356,7 @@ class MeetingService {
return
new
MeetingResponseDTO
(
meeting
,
isParticipant
,
!!
isParticipant
,
hasConflict
,
meeting
.
creator
?.
name
||
'
Unknown
'
);
...
...
@@ -385,31 +376,26 @@ class MeetingService {
try
{
const
meetings
=
await
Meeting
.
findAll
({
attributes
:
[
'
id
'
,
'
title
'
,
'
description
'
,
'
time_idx_start
'
,
'
time_idx_end
'
,
'
location
'
,
'
time_idx_deadline
'
,
'
id
'
,
'
title
'
,
'
description
'
,
'
time_idx_start
'
,
'
time_idx_end
'
,
'
location
'
,
'
time_idx_deadline
'
,
'
type
'
,
'
max_num
'
,
'
cur_num
'
,
'
created_at
'
],
include
:
[
{
model
:
MeetingParticipant
,
as
:
'
participants
'
,
required
:
false
,
attributes
:
[]
where
:
{
user_id
:
userId
}
,
required
:
true
},
{
model
:
User
,
as
:
'
creator
'
,
attributes
:
[
'
name
'
]
attributes
:
[
'
name
'
],
required
:
false
}
],
where
:
{
[
Op
.
or
]:
[
{
created_by
:
userId
},
{
'
$participants.meeting_id$
'
:
{
[
Op
.
col
]:
'
Meeting.id
'
}
},
{
'
$participants.user_id$
'
:
userId
}
]
},
subQuery
:
false
,
order
:
[[
'
created_at
'
,
'
DESC
'
]],
limit
:
limit
+
1
,
offset
,
...
...
@@ -417,29 +403,14 @@ class MeetingService {
});
const
hasNext
=
meetings
.
length
>
limit
;
const
content
=
await
Promise
.
all
(
meetings
.
slice
(
0
,
limit
).
map
(
async
(
meeting
)
=>
{
const
isParticipant
=
await
MeetingParticipant
.
findOne
({
where
:
{
meeting_id
:
meeting
.
id
,
user_id
:
userId
}
});
const
hasConflict
=
await
ScheduleService
.
checkScheduleOverlapByTime
(
userId
,
meeting
.
time_idx_start
,
meeting
.
time_idx_end
);
return
{
...
meeting
.
toJSON
(),
isParticipant
:
!!
isParticipant
,
hasConflict
,
creatorName
:
meeting
.
creator
?.
name
||
'
Unknown
'
};
})
);
const
content
=
meetings
.
slice
(
0
,
limit
).
map
(
meeting
=>
{
return
new
MeetingResponseDTO
(
meeting
,
true
,
// 참여자로 조회했으므로 항상 true
false
,
// 이미 참여 중인 미팅이므로 충돌 체크 불필요
meeting
.
creator
?.
name
||
'
Unknown
'
);
});
return
{
content
,
hasNext
};
}
catch
(
error
)
{
...
...
@@ -447,6 +418,7 @@ class MeetingService {
throw
new
Error
(
'
Failed to fetch my meetings
'
);
}
}
async
getMeetingDetail
(
meetingId
,
userId
)
{
const
meeting
=
await
Meeting
.
findByPk
(
meetingId
,
{
include
:
[
...
...
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