Added email input for KiviOriginals table.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const { currentRealEstate } = require("../helpers/url");
|
||||
const { createRealEstate } = require("../helpers/db/realEstate");
|
||||
const { createKiviOriginal } = require("../helpers/db/kiviOriginal");
|
||||
const { getKiviOriginalById } = require("../helpers/db/kiviOriginal");
|
||||
|
||||
const {
|
||||
AD_CATEGORY,
|
||||
@@ -174,9 +174,11 @@ const postPublishInputs = async (req, res) => {
|
||||
return;
|
||||
}
|
||||
|
||||
//const nextStepPage = req.query.nextStep || "pregled";
|
||||
// const nextStepUrl = `/${nextStepPage}/${searchRequest.id}`;
|
||||
const nextStepUrl = "/unsubscribe/";
|
||||
const kiviOriginal = await getKiviOriginalById(
|
||||
parseInt(realEstate.dataValues.agencyObjectId)
|
||||
);
|
||||
|
||||
const nextStepPage = req.query.nextStep || "/uspjesnaobjava";
|
||||
|
||||
const balcony = req.body.balcony === "on";
|
||||
const elevator = req.body.elevator === "on";
|
||||
@@ -236,6 +238,8 @@ const postPublishInputs = async (req, res) => {
|
||||
|
||||
const locationLat = req.body.lat || null;
|
||||
const locationLong = req.body.lng || null;
|
||||
//Contact email saved in other table
|
||||
const contactEmail = req.body.email || "";
|
||||
|
||||
realEstate.balcony = balcony;
|
||||
realEstate.elevator = elevator;
|
||||
@@ -284,9 +288,13 @@ const postPublishInputs = async (req, res) => {
|
||||
realEstate.locationLat = locationLat;
|
||||
realEstate.locationLong = locationLong;
|
||||
|
||||
kiviOriginal.email = contactEmail;
|
||||
|
||||
await realEstate.save();
|
||||
|
||||
res.redirect(nextStepUrl);
|
||||
await kiviOriginal.save();
|
||||
|
||||
res.redirect(nextStepPage);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
||||
8
app/controllers/publishSuccess.js
Normal file
8
app/controllers/publishSuccess.js
Normal file
@@ -0,0 +1,8 @@
|
||||
const publishSuccess = async (req, res) => {
|
||||
const title = "Uspjeh!";
|
||||
res.render("publishSuccess", { title });
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
publishSuccess
|
||||
};
|
||||
Reference in New Issue
Block a user