This commit is contained in:
2024-12-20 20:14:02 +05:00
parent 07934c610c
commit f9dbbecea6
7 changed files with 191 additions and 38 deletions
+6
View File
@@ -26,6 +26,12 @@ const companySchema = new Schema(
address: {
type: String,
},
startTime: {
type: String,
},
endTime: {
type: String,
},
},
{
timestamps: true,
+17
View File
@@ -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" });