Changed id type to uuid.
This commit is contained in:
@@ -89,6 +89,16 @@ const createRealEstate = async (realEstateFields = {}) => {
|
||||
return await db.RealEstate.create(realEstateFields);
|
||||
};
|
||||
|
||||
const findRealEstateByAgencyId = async kiviId => {
|
||||
try {
|
||||
return db.RealEstate.findOne({
|
||||
where: { agencyObjectId: kiviId }
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("realEstate.js", error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
const findRealEstatesForSearchRequest = async (searchRequest, maxResults) => {
|
||||
const {
|
||||
priceMin,
|
||||
@@ -354,5 +364,6 @@ module.exports = {
|
||||
bulkUpsertRealEstates,
|
||||
getRealEstateById,
|
||||
createRealEstate,
|
||||
findRealEstatesForSearchRequest
|
||||
findRealEstatesForSearchRequest,
|
||||
findRealEstateByAgencyId
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const { getSearchRequest } = require("./db/searchRequest");
|
||||
const { getRealEstateById } = require("./db/realEstate");
|
||||
const { getKiviOriginalById } = require("./db/kiviOriginal");
|
||||
|
||||
const currentSearchRequest = async req => {
|
||||
const searchRequestId =
|
||||
@@ -15,7 +16,16 @@ const currentRealEstate = async req => {
|
||||
|
||||
return await getRealEstateById(parseInt(realEstateId));
|
||||
};
|
||||
const currentKiviRealEstate = async req => {
|
||||
const kiviRealEstateId =
|
||||
req && req.params ? req.params["kiviRealEstateId"] : null;
|
||||
if (!kiviRealEstateId) return null;
|
||||
|
||||
return await getKiviOriginalById(kiviRealEstateId);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
currentSearchRequest,
|
||||
currentRealEstate
|
||||
currentRealEstate,
|
||||
currentKiviRealEstate
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user