Preparing to save results to db
This commit is contained in:
@@ -110,8 +110,6 @@ module.exports = class OlxCrawler {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
async indexPage(url, maxResults = 1000) {
|
||||
try {
|
||||
// console.log('Starting to index page: ' + pageNr);
|
||||
@@ -138,7 +136,7 @@ module.exports = class OlxCrawler {
|
||||
if (singleData) {
|
||||
results.push(singleData);
|
||||
}
|
||||
await this.sleep(500);
|
||||
// await this.sleep(500);
|
||||
}
|
||||
|
||||
return results;
|
||||
@@ -177,7 +175,7 @@ module.exports = class OlxCrawler {
|
||||
let result = await this.indexPage(url, maxResults);
|
||||
// Object.assign(results, result)
|
||||
results.push(result);
|
||||
await this.sleep(5000);
|
||||
// await this.sleep(5000);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
10
app/helpers/db/dbHelper.js
Normal file
10
app/helpers/db/dbHelper.js
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
// const db = require('../../models/index');
|
||||
|
||||
|
||||
// const bulkInsert = async (reuslts) => {
|
||||
// db.MarketAlert.bulkCreate({
|
||||
|
||||
// })
|
||||
|
||||
// }
|
||||
@@ -7,7 +7,7 @@ const currentRERequest = async (req) => {
|
||||
const request = await db.RealEstateRequest.findOne({ where: {uniqueId} });
|
||||
return request;
|
||||
};
|
||||
|
||||
// TODO Fetch only subscribed realestate requests
|
||||
const allRERequest = async () => {
|
||||
return await db.RealEstateRequest.findAll();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user