Skip to content

Commit

Permalink
Merge pull request #18 from michacurri/workorderDisplay
Browse files Browse the repository at this point in the history
Workorder display
  • Loading branch information
michacurri authored Dec 31, 2020
2 parents 999bbd0 + b4ab394 commit 2dc6706
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 51 deletions.
1 change: 0 additions & 1 deletion .eslintcache

This file was deleted.

File renamed without changes.
60 changes: 10 additions & 50 deletions api/routes/workorderRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,53 +10,21 @@ const { createWorkorder } = require("../controllers/workorderController");
// @route GET/workorders
// @desc Returns all workorders
// @access Public
// router.get("/", async (req, res) => {
// try {
// const workorders = await Workorder.find();
// res.json(workorders);
// } catch (err) {
// res.json({ error: err });
// }
// });
router.get("/", async (req, res) => {
try {
const workorders = await Workorder.find();
res.json(workorders);
} catch (err) {
res.json({ error: err });
}
});

// TODO
// @route POST /workorders
// @route POST /api/workorders
// @desc Add a new workorder
// @access Public
// router.post("/create", async (req, res) => {
// // Create a new workorder from the information entered through req.body
// const {
// // dateIn,
// // dateOut,
// brand,
// model,
// colour,
// // service,
// // status,
// // parts,
// } = req.body;

// const newWorkorder = new Workorder({
// // dateIn,
// // dateOut,
// brand,
// model,
// colour,
// // service,
// // status,
// // parts,
// });
// router.post("/create/:userId", async (req, res) => {

// try {
// const workorder = await newWorkorder.save();
// res.json(workorder);
// } catch (err) {
// res.json({ error: err });
// }
// });

// cut and pasted from profileRoutes.js
// will need to be modified to not push, but create NEW
router
// .use(verifyToken)
.route("/create/:userId")
Expand All @@ -80,7 +48,6 @@ router
return;
}
try {
// const profile = await findProfileById(userId);
const newWorkorder = await createWorkorder({
// profile,
userId,
Expand All @@ -93,18 +60,11 @@ router
// status,
// parts,
});
// console.log(`|||| workorderRoutes:96 "newWorkorder": ${newWorkorder}`);
res.status(200).json({ newWorkorder });
} catch (err) {
console.log(err);
res.status(500).json({ message: "Internal server error" });
}
// try {
// const workorder = await newWorkorder.save();
// res.json(workorder);
// } catch (err) {
// res.json({ error: err });
// }
});

// TODO
Expand Down

0 comments on commit 2dc6706

Please sign in to comment.