Started deleting of ads.
This commit is contained in:
23
app/controllers/deleteRealEstate.js
Normal file
23
app/controllers/deleteRealEstate.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const { currentSearchRequest } = require("../helpers/url");
|
||||
|
||||
const getDeletePublishedAd = async (req, res) => {
|
||||
const title = "Uspješno ste izbrisali svoj oglas iz baze.";
|
||||
|
||||
const searchRequest = await currentSearchRequest(req);
|
||||
|
||||
if (!searchRequest || !searchRequest.dataValues) {
|
||||
res.render("notFound", { title: " " });
|
||||
return;
|
||||
}
|
||||
|
||||
searchRequest.subscribed = false;
|
||||
searchRequest.deletedEmail = searchRequest.email;
|
||||
searchRequest.email = "";
|
||||
await searchRequest.save();
|
||||
|
||||
res.render("unsubscribe", { nextStep: "/vrstanekretnine", title });
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getDeletePublishedAd
|
||||
};
|
||||
Reference in New Issue
Block a user