Skip to content

Commit

Permalink
circles 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
IsthisLee committed Dec 10, 2021
1 parent 6129f56 commit 5ff79ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const corsOptions = {
origin: "",
};

app.use(cors(corsOptions));
app.use(cors());

const connect = require("./models");
connect();
Expand Down
28 changes: 12 additions & 16 deletions routers/circles.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const auth = require("../middlewares/auth");

router
.route("/circles/:circles_id/feedback")
.get( async (req, res) => {
.get(async (req, res) => {
const { circles_id } = req.params; // circles_id => unique;

try {
Expand All @@ -19,13 +19,12 @@ router
} catch (error) {
console.log(error);
}

})
.post( async (req, res) => {
.post(async (req, res) => {
const { projects_id, circles_id, feedback } = req.body;

try {
if(feedback==""){
if (feedback == "") {
res.status(400).send({
errorMessage: "피드백을 입력해주세요!",
});
Expand All @@ -43,18 +42,17 @@ router
}
const returnData = await circles.findOne({ circles_id });
res.status(200).send(returnData);
} catch(error) {
} catch (error) {
res.status(400).send({
errorMessage: "피드백 등록에 실패하였습니다!",
});
}

})
.put( async (req, res) => {
.put(async (req, res) => {
const { circles_id, feedback } = req.body;

try{
if(feedback==""){
try {
if (feedback == "") {
res.status(400).send({
errorMessage: "피드백을 입력해주세요!",
});
Expand All @@ -72,15 +70,14 @@ router
}
const returnData = await circles.findOne({ circles_id });
res.status(200).send(returnData);
} catch(error) {
} catch (error) {
res.status(400).send({
errorMessage: "피드백 수정에 실패하였습니다!",
});
}

})
.delete( async (req, res) => {
const { circles_id } = req.body;
.delete(async (req, res) => {
const { circles_id } = req.params;

try {
const successCount = await circles.updateOne(
Expand All @@ -95,12 +92,11 @@ router
}
const returnData = await circles.findOne({ circles_id });
res.status(200).send(returnData);
} catch(error) {
} catch (error) {
res.status(400).send({
errorMessage: "피드백 삭제에 실패하였습니다!",
});
}

});

// 인증 api
Expand Down

0 comments on commit 5ff79ac

Please sign in to comment.