Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7fcb2a278 | ||
|
|
6bad24d735 | ||
|
|
7302edceec | ||
|
|
bd33a6b80e |
@@ -156,33 +156,11 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// If real estate dont have defined number of rooms ex. null
|
// If real estate dont have defined number of rooms ex. null
|
||||||
//It returns requests that didn't choose number of rooms - also null
|
//It returns all search requests except for ones that dont want incpomlete ads
|
||||||
//Or ones that picked some values but also picked to includeIncomplete ads (or default)
|
|
||||||
numberOfRoomsQuery = {
|
numberOfRoomsQuery = {
|
||||||
[Op.or]: [
|
|
||||||
{
|
|
||||||
[Op.and]: [
|
|
||||||
{
|
|
||||||
numberOfRoomsMin: {
|
|
||||||
[Op.is]: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
numberOfRoomsMax: {
|
|
||||||
[Op.is]: null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
includeIncompleteAds: {
|
includeIncompleteAds: {
|
||||||
[Op.or]: {
|
[Op.ne]: false
|
||||||
[Op.eq]: true,
|
|
||||||
[Op.is]: null
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,30 +190,9 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
numberOfFloorsQuery = {
|
numberOfFloorsQuery = {
|
||||||
[Op.or]: [
|
|
||||||
{
|
|
||||||
[Op.and]: [
|
|
||||||
{
|
|
||||||
numberOfFloorsMin: {
|
|
||||||
[Op.is]: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
numberOfFloorsMax: {
|
|
||||||
[Op.is]: null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
includeIncompleteAds: {
|
includeIncompleteAds: {
|
||||||
[Op.or]: {
|
[Op.ne]: false
|
||||||
[Op.eq]: true,
|
|
||||||
[Op.is]: null
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -264,30 +221,9 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
floorQuery = {
|
floorQuery = {
|
||||||
[Op.or]: [
|
|
||||||
{
|
|
||||||
[Op.and]: [
|
|
||||||
{
|
|
||||||
floorMin: {
|
|
||||||
[Op.is]: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
floorMax: {
|
|
||||||
[Op.is]: null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
includeIncompleteAds: {
|
includeIncompleteAds: {
|
||||||
[Op.or]: {
|
[Op.ne]: false
|
||||||
[Op.eq]: true,
|
|
||||||
[Op.is]: null
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -296,7 +232,7 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
|||||||
//If user dont check checkbox for ex. elevator it does not mean he only wants no elevator
|
//If user dont check checkbox for ex. elevator it does not mean he only wants no elevator
|
||||||
//If real estate characteristic =true find all req, one that wants charachertistic or dont care - dont need query
|
//If real estate characteristic =true find all req, one that wants charachertistic or dont care - dont need query
|
||||||
//If real estate characteristic = false, find all req exept for ones that wants characteristic to be true
|
//If real estate characteristic = false, find all req exept for ones that wants characteristic to be true
|
||||||
//If real estate characteristic = null, dont know if true or false, find req that dont care or want char and want incomplete ads
|
//If real estate characteristic = null, dont know if true or false, find all req except ones that dont want incomplete ads
|
||||||
let balconyQuery = {};
|
let balconyQuery = {};
|
||||||
if (realEstateTypeObject.hasBalconyProp && balcony !== true) {
|
if (realEstateTypeObject.hasBalconyProp && balcony !== true) {
|
||||||
if (balcony === false) {
|
if (balcony === false) {
|
||||||
@@ -307,30 +243,9 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
|||||||
};
|
};
|
||||||
} else if (balcony === null) {
|
} else if (balcony === null) {
|
||||||
balconyQuery = {
|
balconyQuery = {
|
||||||
[Op.or]: [
|
|
||||||
{
|
|
||||||
balcony: {
|
|
||||||
[Op.ne]: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
[Op.and]: [
|
|
||||||
{
|
|
||||||
balcony: {
|
|
||||||
[Op.eq]: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
includeIncompleteAds: {
|
includeIncompleteAds: {
|
||||||
[Op.or]: {
|
[Op.ne]: false
|
||||||
[Op.eq]: true,
|
|
||||||
[Op.is]: null
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -344,30 +259,9 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
|||||||
};
|
};
|
||||||
} else if (newBuilding === null) {
|
} else if (newBuilding === null) {
|
||||||
newBuildingQuery = {
|
newBuildingQuery = {
|
||||||
[Op.or]: [
|
|
||||||
{
|
|
||||||
newBuilding: {
|
|
||||||
[Op.ne]: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
[Op.and]: [
|
|
||||||
{
|
|
||||||
newBuilding: {
|
|
||||||
[Op.eq]: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
includeIncompleteAds: {
|
includeIncompleteAds: {
|
||||||
[Op.or]: {
|
[Op.ne]: false
|
||||||
[Op.eq]: true,
|
|
||||||
[Op.is]: null
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -381,33 +275,13 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
|||||||
};
|
};
|
||||||
} else if (elevator === null) {
|
} else if (elevator === null) {
|
||||||
elevatorQuery = {
|
elevatorQuery = {
|
||||||
[Op.or]: [
|
|
||||||
{
|
|
||||||
elevator: {
|
|
||||||
[Op.ne]: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
[Op.and]: [
|
|
||||||
{
|
|
||||||
elevator: {
|
|
||||||
[Op.eq]: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
includeIncompleteAds: {
|
includeIncompleteAds: {
|
||||||
[Op.or]: {
|
[Op.ne]: false
|
||||||
[Op.eq]: true,
|
|
||||||
[Op.is]: null
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//General query consists of each individual query
|
//General query consists of each individual query
|
||||||
const query = {
|
const query = {
|
||||||
adType,
|
adType,
|
||||||
|
|||||||
Reference in New Issue
Block a user