Changed id type to uuid.
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
const { currentRealEstate } = require("../helpers/url");
|
||||
const { createRealEstate } = require("../helpers/db/realEstate");
|
||||
const { currentKiviRealEstate } = require("../helpers/url");
|
||||
const {
|
||||
createRealEstate,
|
||||
findRealEstateByAgencyId
|
||||
} = require("../helpers/db/realEstate");
|
||||
const { createKiviOriginal } = require("../helpers/db/kiviOriginal");
|
||||
|
||||
const { AD_CATEGORY, AD_TYPE, AD_AGENCY } = require("../common/enums");
|
||||
|
||||
const getPublishTypes = async (req, res) => {
|
||||
const realEstate = await currentRealEstate(req);
|
||||
const kiviOriginal = await currentKiviRealEstate(req);
|
||||
|
||||
const realEstate = await findRealEstateByAgencyId(kiviOriginal.kiviAdId);
|
||||
|
||||
const title = "Koju nekretninu nudite?";
|
||||
let selectedAdType = AD_TYPE.AD_TYPE_SALE.id;
|
||||
@@ -32,7 +37,9 @@ const getPublishTypes = async (req, res) => {
|
||||
};
|
||||
|
||||
const postPublishTypes = async (req, res) => {
|
||||
const realEstate = await currentRealEstate(req);
|
||||
const kiviOriginal = await currentKiviRealEstate(req);
|
||||
|
||||
const realEstate = await findRealEstateByAgencyId(kiviOriginal.kiviAdId);
|
||||
|
||||
const adType = parseInt(req.body.adType);
|
||||
|
||||
@@ -57,8 +64,10 @@ const postPublishTypes = async (req, res) => {
|
||||
const nextStepPage = req.query.nextStep || "podacionekretnini";
|
||||
|
||||
let nextStepUrl = "";
|
||||
if (realEstate && realEstate.id) {
|
||||
nextStepUrl = `/${nextStepPage}/${realEstate.id}`;
|
||||
if (kiviOriginal && kiviOriginal.kiviAdId && realEstate && realEstate.id) {
|
||||
//
|
||||
nextStepUrl = `/${nextStepPage}/${kiviOriginal.kiviAdId}`;
|
||||
|
||||
realEstate.adType = adTypeStringId;
|
||||
realEstate.realEstateType = selectedRealEstateType;
|
||||
|
||||
@@ -77,8 +86,7 @@ const postPublishTypes = async (req, res) => {
|
||||
agencyObjectId: newKiviOriginal.kiviAdId
|
||||
});
|
||||
|
||||
//Da li ovaj id ili kivioriginal id ???
|
||||
nextStepUrl = `/${nextStepPage}/${newRealEstate.id}`;
|
||||
nextStepUrl = `/${nextStepPage}/${newKiviOriginal.kiviAdId}`;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
nextStepUrl = `/`;
|
||||
|
||||
Reference in New Issue
Block a user