2019-09-30 10:31:07 +02:00
|
|
|
const { getRealEstateById } = require("../helpers/db/realEstate");
|
2019-09-04 07:00:27 -07:00
|
|
|
|
|
|
|
|
const redirect = async (req, res) => {
|
|
|
|
|
const id = req.params["id"];
|
2019-09-30 10:31:07 +02:00
|
|
|
const marketAlert = await getRealEstateById(id);
|
2019-09-04 07:00:27 -07:00
|
|
|
if (marketAlert) {
|
|
|
|
|
res.redirect(marketAlert.url);
|
|
|
|
|
} else {
|
|
|
|
|
res.send("Not found");
|
|
|
|
|
res.end();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
redirect
|
|
|
|
|
};
|