Added search on backup

This commit is contained in:
Mosiur Rahman
2024-11-29 04:34:26 +06:00
parent 8072741d5c
commit d0956b6b17
8 changed files with 135 additions and 4 deletions

View File

@@ -110,6 +110,18 @@ app.get("/api/backup", async (req,res)=>{
res.send(allBackup)
})
app.post("/api/backup/search", async (req,res)=>{
const searchTerm = req.body.term;
const foundItems = await BackupModel.find({
$or: [
{ projectName: new RegExp(searchTerm,"i") },
{ volumeName: new RegExp(searchTerm, "i") }
]
})
res.status(201).send(foundItems);
})
app.get("/api/update", async (req,res)=>{
const allUpdate = await UpdateModel.find({ deleted: { $ne: true} }).sort({ Date: 'asc' })
res.status(200).send(allUpdate);