Hanyang-UDONG/UDONG-museum

12/5 issues

Closed this issue · 1 comments

  • delete photo, delete exhibition : get -> post로 변경

router.get("/:photoId/delete", (req, res) => {
Photo.deleteOne({ _id: req.params.photoId }, (err) => {
if (err) {
return res.status(400).send(err);
}
return res.status(200).json({
deletePhotoSuccess: true,
});
});
});

  • get user's exhibitions api 추가 : GET_USER_EXHIBITIONS(uid) 내 전시회 가져오기
  • create exhibition : 전시회에 사용된 사진의 used(false -> true), exhibition 필드 수정

router.post('/register', auth, (req,res)=>{
const exhibition = new Exhibition(req.body)
exhibition.user = req.user.id
exhibition.save((err, exhibition) => {
if (err) return res.status(400).send(err);
return res.status(200).json({
registerExhibitionSuccess: true,
exhibition: exhibition,
});
});
});

  • exhibition photo listup

//전시회에 등록된 사진

router.get('/:exhibitionId/photos',(req,res)=>{
    Photo.find({exhibition: req.params.exhibitionId},(err, photos)=>{
        if(err){
            return res.status(400).send(err);
        }
        return res.status(200).json({
            getExhibitionPhotosSuccess: true, 
            photos: photos
        })
    })
})