32 lines
943 B
JavaScript
32 lines
943 B
JavaScript
const { getSearchRequest } = require("./db/searchRequest");
|
|
const { getRealEstateById } = require("./db/realEstate");
|
|
const { getKiviOriginalById } = require("./db/kiviOriginal");
|
|
|
|
const currentSearchRequest = async req => {
|
|
const searchRequestId =
|
|
req && req.params ? req.params["searchRequestId"] : null;
|
|
if (!searchRequestId) return null;
|
|
|
|
return await getSearchRequest(searchRequestId);
|
|
};
|
|
|
|
const currentRealEstate = async req => {
|
|
const realEstateId = req && req.params ? req.params["realEstateId"] : null;
|
|
if (!realEstateId) return null;
|
|
|
|
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,
|
|
currentKiviRealEstate
|
|
};
|