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
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
+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 {
async
getMeetings
(
userId
,
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
;
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
try
{
const
meetings
=
await
Meeting
.
findAll
({
attributes
:
[
'
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
,
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
(
userId
,
meeting
.
time_idx_start
,
meeting
.
time_idx_end
);
const
hasNext
=
meetings
.
length
>
limit
;
const
content
=
await
Promise
.
all
(
meetings
.
slice
(
0
,
limit
).
map
(
async
(
meeting
)
=>
{
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
(
meeting
,
!!
isParticipant
,
hasConflict
,
creatorName
);
})
);
return
new
MeetingResponseDTO
(
meeting
,
isParticipant
,
hasConflict
,
meeting
.
creator
?.
name
||
'
Unknown
'
);
})
);
return
{
content
,
hasNext
};
return
{
content
,
hasNext
};
}
catch
(
error
)
{
console
.
error
(
'
getMeetings error:
'
,
error
);
throw
new
Error
(
'
Failed to fetch meetings
'
);
}
}
async
getMyMeetings
(
userId
,
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
'
,
where
:
{
user_id
:
userId
},
attributes
:
[],
try
{
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
'
]
}
],
where
:
{
[
Op
.
or
]:
[
{
created_by
:
userId
},
{
'
$participants.meeting_id$
'
:
{
[
Op
.
col
]:
'
Meeting.id
'
}
},
{
'
$participants.user_id$
'
:
userId
}
]
},
{
model
:
User
,
as
:
'
creator
'
,
attributes
:
[
'
name
'
],
}
],
where
:
{
[
Op
.
or
]:
[
{
created_by
:
userId
},
{
'
$participants.user_id$
'
:
userId
}
]
},
order
:
[[
'
createdAt
'
,
'
DESC
'
]],
offset
});
subQuery
:
false
,
order
:
[[
'
created_at
'
,
'
DESC
'
]],
limit
:
limit
+
1
,
offset
,
distinct
:
true
});
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
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
);
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
(
meeting
,
!!
isParticipant
,
hasConflict
,
creatorName
);
})
);
return
{
...
meeting
.
toJSON
(),
isParticipant
:
!!
isParticipant
,
hasConflict
,
creatorName
:
meeting
.
creator
?.
name
||
'
Unknown
'
};
})
);
return
{
content
,
hasNext
};
return
{
content
,
hasNext
};
}
catch
(
error
)
{
console
.
error
(
'
getMyMeetings error:
'
,
error
);
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