Skip to content
Snippets Groups Projects
Commit 190903db authored by pjookim's avatar pjookim
Browse files

Merge remote-tracking branch 'refs/remotes/origin/main'

parents 53331550 ccb4ac11
No related branches found
No related tags found
No related merge requests found
......@@ -64,24 +64,12 @@ const deleteTrip = async (req, res) => {
// 공동 작업자 추가
const addCollaborator = async (req, res) => {
try {
const { collaboratorEmail, collaboratorName } = req.body;
const { collaboratorEmail } = req.body;
let collaborator;
if (collaboratorEmail) {
collaborator = await User.findOne({ email: collaboratorEmail });
const 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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment