Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
When Meet - Backend
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
websystem2023-2
When Meet - Backend
Commits
7356196e
Commit
7356196e
authored
1 year ago
by
Wo-ogie
Browse files
Options
Downloads
Patches
Plain Diff
feat: 참가자 생성 시 약속 최대 참가자 수를 넘어선다면 에러가 발생하도록 예외처리 추가
parent
8ce5b334
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
controllers/meeting.js
+1
-8
1 addition, 8 deletions
controllers/meeting.js
controllers/participant.js
+15
-1
15 additions, 1 deletion
controllers/participant.js
errors/meetingErrors.js
+8
-0
8 additions, 0 deletions
errors/meetingErrors.js
services/meeting.js
+8
-0
8 additions, 0 deletions
services/meeting.js
with
32 additions
and
9 deletions
controllers/meeting.js
+
1
−
8
View file @
7356196e
...
...
@@ -5,6 +5,7 @@ const {
getMeetingById
,
getMeetingWithParticipantsById
,
getMeetingWithParticipantsAndSchedulesById
,
getNumOfParticipantsByMeetingId
,
closeMeetingById
,
}
=
require
(
'
../services/meeting
'
);
const
{
...
...
@@ -44,14 +45,6 @@ async function getParticipantByNameAndMeetingId(name, meetingId) {
return
participant
;
}
async
function
getNumOfParticipantsByMeetingId
(
meetingId
)
{
return
Participant
.
count
({
where
:
{
MeetingId
:
meetingId
,
},
});
}
async
function
validatePasswordIsMatched
(
requestPassword
,
exPassword
)
{
if
(
!
requestPassword
)
{
throw
createPasswordIsNullError
();
...
...
This diff is collapsed.
Click to expand it.
controllers/participant.js
+
15
−
1
View file @
7356196e
const
bcrypt
=
require
(
'
bcrypt
'
);
const
{
createPasswordIsNullError
}
=
require
(
'
../errors/meetingErrors
'
);
const
{
getMeetingById
,
getNumOfParticipantsByMeetingId
,
}
=
require
(
'
../services/meeting
'
);
const
{
createPasswordIsNullError
,
createMaxParticipantsError
,
}
=
require
(
'
../errors/meetingErrors
'
);
const
{
createParticipantIsAlreadyExistError
,
createParticipantNotFoundError
,
...
...
@@ -65,6 +72,13 @@ exports.createParticipant = async (req, res, next) => {
const
reqPassword
=
req
.
body
.
password
||
null
;
const
reqEmail
=
req
.
body
.
email
||
null
;
try
{
const
meeting
=
await
getMeetingById
(
meetingId
);
const
currentParticipants
=
await
getNumOfParticipantsByMeetingId
(
meetingId
);
if
(
currentParticipants
>=
meeting
.
maxParticipants
)
{
throw
createMaxParticipantsError
();
}
const
existingParticipant
=
await
findParticipantByMeetingIdAndName
(
meetingId
,
reqName
,
...
...
This diff is collapsed.
Click to expand it.
errors/meetingErrors.js
+
8
−
0
View file @
7356196e
...
...
@@ -29,3 +29,11 @@ exports.createMostConfirmedTimeNotFoundError = () => {
error
.
status
=
404
;
return
error
;
};
exports
.
createMaxParticipantsError
=
()
=>
{
const
error
=
new
Error
(
'
설정된 최대 참가자가 모두 참여했습니다. 더 이상 새로 참가하실 수 없습니다.
'
,
);
error
.
status
=
409
;
return
error
;
};
This diff is collapsed.
Click to expand it.
services/meeting.js
+
8
−
0
View file @
7356196e
...
...
@@ -50,6 +50,13 @@ const getMeetingWithParticipantsAndSchedulesById = async (meetingId) => {
return
meeting
;
};
const
getNumOfParticipantsByMeetingId
=
async
(
meetingId
)
=>
Participant
.
count
({
where
:
{
MeetingId
:
meetingId
,
},
});
function
validateMeetingIsNotClosed
(
meeting
)
{
if
(
meeting
.
isClosed
===
true
)
{
throw
createMeetingIsAlreadyClosedError
();
...
...
@@ -75,5 +82,6 @@ module.exports = {
getMeetingById
,
getMeetingWithParticipantsById
,
getMeetingWithParticipantsAndSchedulesById
,
getNumOfParticipantsByMeetingId
,
closeMeetingById
,
};
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