Changed to send email only to some users.

This commit is contained in:
Naida Vatric
2020-01-24 16:04:28 +01:00
parent 40509d2836
commit 470f53d29b
3 changed files with 13 additions and 10 deletions

View File

@@ -1,5 +1,7 @@
"use strict";
const db = require("../../models/index");
const sequelize = require("sequelize");
const Op = sequelize.Op;
const { CHECK_UP_DAYS } = require("../../config/appConfig");
const findRealEstatesForSearchRequest = async searchRequestId => {
@@ -53,11 +55,18 @@ const findAllRequestsForCheckUp = async () => {
}
};
const excludedRequests = await db.SearchRequestMatch.findAll({
const excludedMatches = await db.SearchRequestMatch.findAll({
attributes: ["searchRequestId"],
where: dateQuery
where: dateQuery,
order: [["searchRequestId", "ASC"]]
});
const excludedRequestsAll = excludedMatches.map(match => {
return match.dataValues.searchRequestId;
});
//Removing duplicate search request id-s for optimization
const excludedRequests = [...new Set(excludedRequestsAll)];
const query = {
subscribed: true,
id: {