Notification service #35

Merged
bilal.catic merged 26 commits from notification-service into master 2019-09-30 16:23:40 +02:00
Showing only changes of commit 0fdef956a7 - Show all commits

View File

@@ -6,9 +6,19 @@ const findRealEstatesForSearchRequest = async searchRequestId => {
searchRequestId
};
const include = [{ model: db.RealEstate }];
const include = [{ model: db.RealEstate, as: "realEstates" }];
return await db.SearchRequestMatch.findAll({ where: query, include });
const matches = await db.SearchRequestMatch.findAll({
where: query,
include
});
const matchingRealEstates = [];
for (const match of matches) {
matchingRealEstates.push(...match.realEstates);
}
return matchingRealEstates;
};
const addMatches = async matchingRecords => {