upd
This commit is contained in:
@@ -26,6 +26,12 @@ const companySchema = new Schema(
|
||||
address: {
|
||||
type: String,
|
||||
},
|
||||
startTime: {
|
||||
type: String,
|
||||
},
|
||||
endTime: {
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
|
||||
@@ -24,6 +24,23 @@ router.get("/:companyId", async (req, res) => {
|
||||
res.json(company);
|
||||
});
|
||||
|
||||
router.put("/:companyId", async (req, res) => {
|
||||
if (req.params.companyId != res.locals.user.companyId) {
|
||||
res.json({ error: "Access denied" });
|
||||
return;
|
||||
}
|
||||
|
||||
const company = await Company.findByIdAndUpdate(
|
||||
req.params.companyId,
|
||||
req.body,
|
||||
{
|
||||
new: true,
|
||||
}
|
||||
);
|
||||
|
||||
res.json(company);
|
||||
});
|
||||
|
||||
router.get("/:companyId/builds", async (req, res) => {
|
||||
if (req.params.companyId != res.locals.user.companyId) {
|
||||
res.json({ error: "Access denied" });
|
||||
|
||||
Reference in New Issue
Block a user