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
a7f956df
Commit
a7f956df
authored
3 months ago
by
조대희
Browse files
Options
Downloads
Patches
Plain Diff
refactor: 내 미팅/ 전체 미팅 조회 서비스 수정
parent
110c8109
No related branches found
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
+117
-108
117 additions, 108 deletions
services/meetingService.js
with
117 additions
and
108 deletions
services/meetingService.js
+
117
−
108
View file @
a7f956df
...
@@ -314,130 +314,139 @@ class MeetingService {
...
@@ -314,130 +314,139 @@ class MeetingService {
async
getMeetings
(
userId
,
pagination
)
{
async
getMeetings
(
userId
,
pagination
)
{
const
{
limit
=
20
,
offset
=
0
}
=
pagination
;
const
{
limit
=
20
,
offset
=
0
}
=
pagination
;
const
meetings
=
await
Meeting
.
findAll
({
attributes
:
[
'
id
'
,
'
title
'
,
'
description
'
,
'
time_idx_start
'
,
'
time_idx_end
'
,
'
location
'
,
'
time_idx_deadline
'
,
'
type
'
,
'
max_num
'
,
'
cur_num
'
,
],
include
:
[
{
model
:
MeetingParticipant
,
as
:
'
participants
'
,
required
:
false
,
attributes
:
[],
},
{
model
:
User
,
as
:
'
creator
'
,
attributes
:
[
'
name
'
],
}
],
order
:
[[
'
createdAt
'
,
'
DESC
'
]],
offset
});
const
hasNext
=
meetings
.
length
>
limit
;
try
{
const
content
=
await
Promise
.
all
(
const
meetings
=
await
Meeting
.
findAll
({
meetings
.
slice
(
0
,
limit
).
map
(
async
(
meeting
)
=>
{
attributes
:
[
const
isParticipant
=
await
MeetingParticipant
.
findOne
({
'
id
'
,
'
title
'
,
'
description
'
,
where
:
{
'
time_idx_start
'
,
'
time_idx_end
'
,
meeting_id
:
meeting
.
id
,
'
location
'
,
'
time_idx_deadline
'
,
user_id
:
userId
'
type
'
,
'
max_num
'
,
'
cur_num
'
,
'
created_at
'
],
include
:
[
{
model
:
MeetingParticipant
,
as
:
'
participants
'
,
required
:
false
,
where
:
{
user_id
:
userId
},
attributes
:
[]
},
{
model
:
User
,
as
:
'
creator
'
,
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
,
distinct
:
true
});
const
hasConflict
=
await
ScheduleService
.
checkScheduleOverlapByTime
(
const
hasNext
=
meetings
.
length
>
limit
;
userId
,
const
content
=
await
Promise
.
all
(
meeting
.
time_idx_start
,
meetings
.
slice
(
0
,
limit
).
map
(
async
(
meeting
)
=>
{
meeting
.
time_idx_end
const
isParticipant
=
true
;
);
const
hasConflict
=
await
ScheduleService
.
checkScheduleOverlapByTime
(
userId
,
meeting
.
time_idx_start
,
meeting
.
time_idx_end
);
const
creatorName
=
meeting
.
creator
?
meeting
.
creator
.
name
:
'
Unknown
'
;
return
new
MeetingResponseDTO
(
return
new
MeetingResponseDTO
(
meeting
,
!!
isParticipant
,
hasConflict
,
creatorName
);
meeting
,
})
isParticipant
,
);
hasConflict
,
meeting
.
creator
?.
name
||
'
Unknown
'
);
})
);
return
{
return
{
content
,
hasNext
};
content
,
}
catch
(
error
)
{
hasNext
console
.
error
(
'
getMeetings error:
'
,
error
);
};
throw
new
Error
(
'
Failed to fetch meetings
'
);
}
}
}
async
getMyMeetings
(
userId
,
pagination
)
{
async
getMyMeetings
(
userId
,
pagination
)
{
const
{
limit
=
20
,
offset
=
0
}
=
pagination
;
const
{
limit
=
20
,
offset
=
0
}
=
pagination
;
const
meetings
=
await
Meeting
.
findAll
({
try
{
attributes
:
[
const
meetings
=
await
Meeting
.
findAll
({
'
id
'
,
attributes
:
[
'
title
'
,
'
id
'
,
'
title
'
,
'
description
'
,
'
time_idx_start
'
,
'
description
'
,
'
time_idx_end
'
,
'
location
'
,
'
time_idx_deadline
'
,
'
time_idx_start
'
,
'
type
'
,
'
max_num
'
,
'
cur_num
'
,
'
time_idx_end
'
,
],
'
location
'
,
include
:
[
'
time_idx_deadline
'
,
{
'
type
'
,
model
:
MeetingParticipant
,
'
max_num
'
,
as
:
'
participants
'
,
'
cur_num
'
,
required
:
false
,
],
attributes
:
[]
include
:
[
},
{
{
model
:
MeetingParticipant
,
model
:
User
,
as
:
'
participants
'
,
as
:
'
creator
'
,
where
:
{
user_id
:
userId
},
attributes
:
[
'
name
'
]
attributes
:
[],
}
],
where
:
{
[
Op
.
or
]:
[
{
created_by
:
userId
},
{
'
$participants.meeting_id$
'
:
{
[
Op
.
col
]:
'
Meeting.id
'
}
},
{
'
$participants.user_id$
'
:
userId
}
]
},
},
{
subQuery
:
false
,
model
:
User
,
order
:
[[
'
created_at
'
,
'
DESC
'
]],
as
:
'
creator
'
,
limit
:
limit
+
1
,
attributes
:
[
'
name
'
],
offset
,
}
distinct
:
true
],
});
where
:
{
[
Op
.
or
]:
[
{
created_by
:
userId
},
{
'
$participants.user_id$
'
:
userId
}
]
},
order
:
[[
'
createdAt
'
,
'
DESC
'
]],
offset
});
const
hasNext
=
meetings
.
length
>
limit
;
const
hasNext
=
meetings
.
length
>
limit
;
const
content
=
await
Promise
.
all
(
const
content
=
await
Promise
.
all
(
meetings
.
slice
(
0
,
limit
).
map
(
async
(
meeting
)
=>
{
meetings
.
slice
(
0
,
limit
).
map
(
async
(
meeting
)
=>
{
const
isParticipant
=
await
MeetingParticipant
.
findOne
({
const
isParticipant
=
await
MeetingParticipant
.
findOne
({
where
:
{
where
:
{
meeting_id
:
meeting
.
id
,
meeting_id
:
meeting
.
id
,
user_id
:
userId
user_id
:
userId
}
}
});
});
const
hasConflict
=
await
ScheduleService
.
checkScheduleOverlapByTime
(
const
hasConflict
=
await
ScheduleService
.
checkScheduleOverlapByTime
(
userId
,
userId
,
meeting
.
time_idx_start
,
meeting
.
time_idx_start
,
meeting
.
time_idx_end
meeting
.
time_idx_end
);
);
const
creatorName
=
meeting
.
creator
?
meeting
.
creator
.
name
:
'
Unknown
'
;
return
{
return
new
MeetingResponseDTO
(
meeting
,
!!
isParticipant
,
hasConflict
,
creatorName
);
...
meeting
.
toJSON
(),
})
isParticipant
:
!!
isParticipant
,
);
hasConflict
,
creatorName
:
meeting
.
creator
?.
name
||
'
Unknown
'
};
})
);
return
{
return
{
content
,
hasNext
};
content
,
}
catch
(
error
)
{
hasNext
console
.
error
(
'
getMyMeetings error:
'
,
error
);
};
throw
new
Error
(
'
Failed to fetch my meetings
'
);
}
}
}
async
getMeetingDetail
(
meetingId
,
userId
)
{
async
getMeetingDetail
(
meetingId
,
userId
)
{
const
meeting
=
await
Meeting
.
findByPk
(
meetingId
,
{
const
meeting
=
await
Meeting
.
findByPk
(
meetingId
,
{
include
:
[
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