Added notification for new ad pusblish and new real estate.

This commit is contained in:
Naida Vatric
2020-03-16 16:13:16 +01:00
parent 981faeb610
commit 084766d0ea
3 changed files with 47 additions and 3 deletions

View File

@@ -1,7 +1,10 @@
const { findRealEstateByAgencyId } = require("../helpers/db/realEstate");
const { bulkUpsertKiviPhotos } = require("../helpers/db/kiviOriginalAdsPhotos");
const { currentKiviRealEstate } = require("../helpers/url");
const {
notifyForNewRealEstates,
notifyForNewAdPublish
} = require("../services/notificationService");
const validate = require("validate.js");
const {
@@ -318,6 +321,11 @@ const postPublishInputs = async (req, res) => {
await kiviOriginal.save();
//Calling function to notify real estate owner that ads is published on Kivi page after 1 sec
setTimeout(notifyForNewAdPublish, 1000, realEstate, kiviOriginal);
//Calling function to notify users of new real estate after 2 min
setTimeout(notifyForNewRealEstates, 1000 * 60 * 2, [realEstate]);
res.redirect(nextStepPage);
};