Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7fcb2a278 | ||
|
|
6bad24d735 | ||
|
|
7302edceec | ||
|
|
bd33a6b80e |
@@ -156,33 +156,11 @@ 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 default)
|
||||
//It returns all search requests except for ones that dont want incpomlete ads
|
||||
numberOfRoomsQuery = {
|
||||
[Op.or]: [
|
||||
{
|
||||
[Op.and]: [
|
||||
{
|
||||
numberOfRoomsMin: {
|
||||
[Op.is]: null
|
||||
}
|
||||
},
|
||||
{
|
||||
numberOfRoomsMax: {
|
||||
[Op.is]: null
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
includeIncompleteAds: {
|
||||
[Op.or]: {
|
||||
[Op.eq]: true,
|
||||
[Op.is]: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
includeIncompleteAds: {
|
||||
[Op.ne]: false
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -212,30 +190,9 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
};
|
||||
} else {
|
||||
numberOfFloorsQuery = {
|
||||
[Op.or]: [
|
||||
{
|
||||
[Op.and]: [
|
||||
{
|
||||
numberOfFloorsMin: {
|
||||
[Op.is]: null
|
||||
}
|
||||
},
|
||||
{
|
||||
numberOfFloorsMax: {
|
||||
[Op.is]: null
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
includeIncompleteAds: {
|
||||
[Op.or]: {
|
||||
[Op.eq]: true,
|
||||
[Op.is]: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
includeIncompleteAds: {
|
||||
[Op.ne]: false
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -264,30 +221,9 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
};
|
||||
} else {
|
||||
floorQuery = {
|
||||
[Op.or]: [
|
||||
{
|
||||
[Op.and]: [
|
||||
{
|
||||
floorMin: {
|
||||
[Op.is]: null
|
||||
}
|
||||
},
|
||||
{
|
||||
floorMax: {
|
||||
[Op.is]: null
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
includeIncompleteAds: {
|
||||
[Op.or]: {
|
||||
[Op.eq]: true,
|
||||
[Op.is]: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
includeIncompleteAds: {
|
||||
[Op.ne]: false
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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 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 = 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 = {};
|
||||
if (realEstateTypeObject.hasBalconyProp && balcony !== true) {
|
||||
if (balcony === false) {
|
||||
@@ -307,30 +243,9 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
};
|
||||
} else if (balcony === null) {
|
||||
balconyQuery = {
|
||||
[Op.or]: [
|
||||
{
|
||||
balcony: {
|
||||
[Op.ne]: true
|
||||
}
|
||||
},
|
||||
{
|
||||
[Op.and]: [
|
||||
{
|
||||
balcony: {
|
||||
[Op.eq]: true
|
||||
}
|
||||
},
|
||||
{
|
||||
includeIncompleteAds: {
|
||||
[Op.or]: {
|
||||
[Op.eq]: true,
|
||||
[Op.is]: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
includeIncompleteAds: {
|
||||
[Op.ne]: false
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -344,30 +259,9 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
};
|
||||
} else if (newBuilding === null) {
|
||||
newBuildingQuery = {
|
||||
[Op.or]: [
|
||||
{
|
||||
newBuilding: {
|
||||
[Op.ne]: true
|
||||
}
|
||||
},
|
||||
{
|
||||
[Op.and]: [
|
||||
{
|
||||
newBuilding: {
|
||||
[Op.eq]: true
|
||||
}
|
||||
},
|
||||
{
|
||||
includeIncompleteAds: {
|
||||
[Op.or]: {
|
||||
[Op.eq]: true,
|
||||
[Op.is]: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
includeIncompleteAds: {
|
||||
[Op.ne]: false
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -381,33 +275,13 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
};
|
||||
} else if (elevator === null) {
|
||||
elevatorQuery = {
|
||||
[Op.or]: [
|
||||
{
|
||||
elevator: {
|
||||
[Op.ne]: true
|
||||
}
|
||||
},
|
||||
{
|
||||
[Op.and]: [
|
||||
{
|
||||
elevator: {
|
||||
[Op.eq]: true
|
||||
}
|
||||
},
|
||||
{
|
||||
includeIncompleteAds: {
|
||||
[Op.or]: {
|
||||
[Op.eq]: true,
|
||||
[Op.is]: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
includeIncompleteAds: {
|
||||
[Op.ne]: false
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//General query consists of each individual query
|
||||
const query = {
|
||||
adType,
|
||||
|
||||
Reference in New Issue
Block a user