Working on complete task

This commit is contained in:
Mosiur Rahman
2024-11-27 22:15:21 +06:00
parent b6163a7ecf
commit b1d976f1fc
7 changed files with 188 additions and 19 deletions

View File

@@ -80,15 +80,16 @@ app.get("/", (req,res)=>{
res.send("Server Ran Properly")
})
app.get("/api/backup", async (req,res)=>{
const allBackup = await BackupModel.find({ deleted: { $ne: true} }).sort({ projectName: 'asc' })
res.send(allBackup)
})
app.get("/api/update", async (req,res)=>{
const allUpdate = await UpdateModel.find({}).sort({ Date: 'asc' })
res.status(200).send(allUpdate);
})
app.get("/api/backup", async (req,res)=>{
const allBackup = await BackupModel.find({ deleted: { $ne: true} }).sort({ projectName: 'asc' })
res.send(allBackup)
})
app.post("/api/update/add", async (req,res)=>{
const {Date, Details, Reference, Remarks, Sales, Handler, Status, deleted} = req.body;
@@ -110,6 +111,16 @@ app.post("/api/update/add", async (req,res)=>{
})
})
app.post("/api/update/complete", async(req,res)=>{
const id = req.body.id;
const status = req.body.Status;
const update = await BackupModel.findOneAndUpdate({_id: id},{ Status: status })
console.log(update)
if (update) {
res.send(update)
}
})
const PORT = 3000;
app.listen(PORT,()=>{