remove listings from listingstable when clicked

This commit is contained in:
orangecoding
2025-10-03 13:27:44 +02:00
parent f97fb48e51
commit 3aa30bc1e2
5 changed files with 69 additions and 7 deletions

View File

@@ -22,10 +22,23 @@ listingsRouter.get('/table', async (req, res) => {
res.send();
});
listingsRouter.delete('/', async (req, res) => {
listingsRouter.delete('/job', async (req, res) => {
const { jobId } = req.body;
try {
listingStorage.deleteListings(jobId);
listingStorage.deleteListingsByJobId(jobId);
} catch (error) {
res.send(new Error(error));
logger.error(error);
}
res.send();
});
listingsRouter.delete('/', async (req, res) => {
const { ids } = req.body;
try {
if (Array.isArray(ids) && ids.length > 0) {
listingStorage.deleteListingsById(ids);
}
} catch (error) {
res.send(new Error(error));
logger.error(error);