Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
festivelo_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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
During summer vacation, Gitlab will be restart frequently. Use it carefully.
Show more breadcrumbs
Festivelo
festivelo_backend
Commits
0dc0ce35
Commit
0dc0ce35
authored
8 months ago
by
Jinyeong Kim
Browse files
Options
Downloads
Patches
Plain Diff
add user name search
parent
07d56c31
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
controllers/TripController.js
+17
-6
17 additions, 6 deletions
controllers/TripController.js
with
17 additions
and
6 deletions
controllers/TripController.js
+
17
−
6
View file @
0dc0ce35
...
...
@@ -64,12 +64,24 @@ const deleteTrip = async (req, res) => {
// 공동 작업자 추가
const
addCollaborator
=
async
(
req
,
res
)
=>
{
try
{
const
{
collaboratorEmail
}
=
req
.
body
;
const
{
collaboratorEmail
,
collaboratorName
}
=
req
.
body
;
const
collaborator
=
await
User
.
findOne
({
email
:
collaboratorEmail
});
let
collaborator
;
if
(
collaboratorEmail
)
{
collaborator
=
await
User
.
findOne
({
email
:
collaboratorEmail
});
if
(
!
collaborator
)
{
return
res
.
status
(
404
).
json
({
message
:
'
해당 이메일의 사용자를 찾을 수 없습니다.
'
});
}
}
else
if
(
collaboratorName
)
{
collaborator
=
await
User
.
findOne
({
name
:
collaboratorName
});
if
(
!
collaborator
)
{
return
res
.
status
(
404
).
json
({
message
:
'
해당 이름의 사용자를 찾을 수 없습니다.
'
});
}
return
res
.
status
(
200
).
json
({
email
:
collaborator
.
email
});
}
else
{
return
res
.
status
(
400
).
json
({
message
:
'
이메일 또는 이름을 제공해야 합니다.
'
});
}
const
trip
=
await
Trip
.
findById
(
req
.
params
.
id
).
populate
(
'
create_by
'
);
if
(
!
trip
)
{
...
...
@@ -143,7 +155,6 @@ const addDayPlan = async (req, res) => {
console
.
error
(
'
Error updating day:
'
,
err
);
res
.
status
(
500
).
json
({
error
:
err
.
message
});
}
};
module
.
exports
=
{
...
...
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