Compare commits
4 Commits
email-noti
...
include-in
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81fa3f046d | ||
|
|
fc7fe3c0b3 | ||
|
|
b3007123a5 | ||
|
|
f7d4a9cd07 |
@@ -9,7 +9,7 @@ const APP_URL =
|
||||
? process.env.APP_URL || "http://market-alarm"
|
||||
: process.env.APP_URL || `${APP_BASE_URL}:${APP_PORT}`;
|
||||
|
||||
const STAGING = process.env.SETTINGS !== "production";
|
||||
const STAGING = process.env.ENVIRONMENT !== "production";
|
||||
|
||||
const DEFAULT_TIMEZONE = "Europe/Sarajevo";
|
||||
|
||||
@@ -55,5 +55,4 @@ module.exports = {
|
||||
STAGING,
|
||||
CHECK_UP_DAYS,
|
||||
PROSTOR_LOGIN
|
||||
|
||||
};
|
||||
|
||||
@@ -332,10 +332,14 @@ const findRealEstatesForSearchRequest = async (searchRequest, maxResults) => {
|
||||
};
|
||||
}
|
||||
|
||||
//When includeIncompleteAds are not defined - null it will consider it true
|
||||
const order = [["updatedAt", "desc"]];
|
||||
|
||||
return db.RealEstate.findAll({
|
||||
where: includeIncompleteAds ? queryIncludeIncomplete : query,
|
||||
where:
|
||||
includeIncompleteAds || includeIncompleteAds == null
|
||||
? queryIncludeIncomplete
|
||||
: query,
|
||||
limit: maxResults,
|
||||
order
|
||||
});
|
||||
|
||||
@@ -157,7 +157,7 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
} else {
|
||||
// If real estate dont have defined number of rooms ex. null
|
||||
//It returns requests that didn't choose number of rooms - also null
|
||||
//Or ones that picked some values but also picked to includeIncomplete ads
|
||||
//Or ones that picked some values but also picked to includeIncomplete ads (or default)
|
||||
numberOfRoomsQuery = {
|
||||
[Op.or]: [
|
||||
{
|
||||
@@ -176,7 +176,10 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
},
|
||||
{
|
||||
includeIncompleteAds: {
|
||||
[Op.eq]: true
|
||||
[Op.or]: {
|
||||
[Op.eq]: true,
|
||||
[Op.is]: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -226,7 +229,10 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
},
|
||||
{
|
||||
includeIncompleteAds: {
|
||||
[Op.eq]: true
|
||||
[Op.or]: {
|
||||
[Op.eq]: true,
|
||||
[Op.is]: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -275,7 +281,10 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
},
|
||||
{
|
||||
includeIncompleteAds: {
|
||||
[Op.eq]: true
|
||||
[Op.or]: {
|
||||
[Op.eq]: true,
|
||||
[Op.is]: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -313,7 +322,10 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
},
|
||||
{
|
||||
includeIncompleteAds: {
|
||||
[Op.eq]: true
|
||||
[Op.or]: {
|
||||
[Op.eq]: true,
|
||||
[Op.is]: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -347,7 +359,10 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
},
|
||||
{
|
||||
includeIncompleteAds: {
|
||||
[Op.eq]: true
|
||||
[Op.or]: {
|
||||
[Op.eq]: true,
|
||||
[Op.is]: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -381,7 +396,10 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
},
|
||||
{
|
||||
includeIncompleteAds: {
|
||||
[Op.eq]: true
|
||||
[Op.or]: {
|
||||
[Op.eq]: true,
|
||||
[Op.is]: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -423,10 +441,13 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
[Op.eq]: "ANY"
|
||||
};
|
||||
}
|
||||
//Tag to check if incomplete ads are accepted in query
|
||||
//Tag to check if incomplete ads are accepted in query which is default
|
||||
if (checkForIncompleteWanted) {
|
||||
query.includeIncompleteAds = {
|
||||
[Op.eq]: true
|
||||
[Op.or]: {
|
||||
[Op.eq]: true,
|
||||
[Op.is]: null
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ const notifyRequestsWithDailyOption = async () => {
|
||||
};
|
||||
|
||||
const checkUpNotify = async () => {
|
||||
const searchRequestsForCheckUp = await findAllRequestsForCheckUp();
|
||||
/* const searchRequestsForCheckUp = await findAllRequestsForCheckUp();
|
||||
|
||||
const asyncSendEmailActions = [];
|
||||
|
||||
@@ -144,7 +144,7 @@ const checkUpNotify = async () => {
|
||||
asyncSendEmailActions.push(sendEmailPromise);
|
||||
sendEmailPromise.catch(err => console.log("[Email Sending Failed]", err));
|
||||
}
|
||||
await Promise.all(asyncSendEmailActions);
|
||||
await Promise.all(asyncSendEmailActions); */
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -61,9 +61,8 @@
|
||||
<p class="distinguished">
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" class="filled-in" name="includeIncompleteAds"
|
||||
<% if (includeIncompleteAds) { %>
|
||||
checked
|
||||
<% } %>>
|
||||
>
|
||||
<span>Uključi i oglase bez potpunih informacija</span>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
@@ -8,7 +8,7 @@ SEQUELIZE_LOGGING=0- no sequelize logging, 1- log to the console
|
||||
PORT=Port for the app, defaults to 5000
|
||||
APP_BASE_URL=base url for the app
|
||||
|
||||
SETTINGS=Variable to denote development, staging and production
|
||||
ENVIRONMENT=Variable to denote development, staging and production
|
||||
|
||||
|
||||
MAX_REAL_ESTATES_IN_EMAIL=Max number of real estates that will be shown in email, others will be truncated and URL with full list will be shwon
|
||||
|
||||
Reference in New Issue
Block a user