Compare commits

...

108 Commits

Author SHA1 Message Date
Nedim Uka
a457226207 Fixed margin for navbar 2019-07-29 14:39:31 +02:00
Nedim Uka
4f35305b0a Show only 10 realestates in notificatio email 2019-07-29 13:04:25 +02:00
Nedim Uka
09792db21c Merge branch 'marketalerts-page' into 'master'
Real Estate Page

See merge request saburly/marketalarm/web!24
2019-07-15 09:48:08 +00:00
Nedim Uka
1999d45cb2 Changed template name 2019-07-15 11:47:41 +02:00
Nedim Uka
778b5ff411 Fixed bug, for duplicate results for 2 similar re reqests of one user 2019-07-15 11:40:28 +02:00
Nedim Uka
81c30c36ec Added realestate link to bulk email 2019-07-12 18:00:02 +02:00
Nedim Uka
753a09aa36 Fixed crawler not reading and comparing all RERequest results 2019-07-12 16:13:03 +02:00
Bilal Catic
4517624fa8 Merge branch 'nav-bar' into 'master'
Handle nav-bar

See merge request saburly/marketalarm/web!23
2019-07-12 13:22:16 +00:00
Nedim Uka
f9abf48f61 Removed unecessary comments 2019-07-12 10:53:23 +02:00
Nedim Uka
afeffe8c71 Added roboto font 2019-07-11 14:33:59 +02:00
Nedim Uka
a6bd63b7b8 Handle nav-bar 2019-07-11 14:25:38 +02:00
Bilal Catic
e305c547e1 Merge branch 'fetch-optimisation' into 'master'
Fetch optimization

See merge request saburly/marketalarm/web!22
2019-07-10 14:35:37 +00:00
Nedim Uka
33f9e37d93 Filter data by geolocation now sets hasLocation boolean instead of excluding results 2019-07-10 15:21:46 +02:00
Nedim Uka
5829de64e0 Added hrefs to global varialbe 2019-07-10 12:39:32 +02:00
Bilal Catic
efea857889 Merge branch 'services-scheduler' into 'master'
Added node schedule to run crawler and notification service

See merge request saburly/marketalarm/web!21
2019-07-09 21:51:15 +00:00
Nedim Uka
a43723485c Added node schedule to run crawler and notification service 2019-07-09 16:33:00 +02:00
Nedim Uka
1b098f181c Reduced pager to 5 pages at a time 2019-07-08 13:02:28 +02:00
Bilal Catic
2dd1eaa5fd Merge branch 'crawler-optimisation' into 'master'
Crawler optimisation

See merge request saburly/marketalarm/web!20
2019-07-08 08:01:48 +00:00
Nedim Uka
039b1a6376 Optimiset crawlers , and pagingation 2019-07-05 17:18:47 +02:00
Nedim Uka
222a134bbf Optimised crawler speed by using promises 2019-07-04 17:28:09 +02:00
Nedim Uka
0672f3c019 Changed template name 2019-07-04 09:51:04 +02:00
Bilal Catic
e4b3e3961d Merge branch 'notification-email-subject' into 'master'
Notification email subject

See merge request saburly/marketalarm/web!19
2019-07-04 07:44:49 +00:00
Nedim Uka
a807cb5bf2 Bulk emali subject 2019-07-03 16:01:55 +02:00
Nedim Uka
b79a274f96 Added formated subject to bulk email 2019-07-02 21:49:56 +02:00
Bilal Catic
7f0b2d299e Merge branch 'send-notification' into 'master'
Send notification

See merge request saburly/marketalarm/web!18
2019-07-02 10:32:11 +00:00
Nedim Uka
8b20f0e170 Formated title 2019-07-02 12:25:22 +02:00
Nedim Uka
93c147e73b Looged amazon send bulk email response, fixed some emails not sent bug 2019-07-02 11:54:33 +02:00
Nedim Uka
96e9da1fb1 Send templated bulk email, and remember notifed marketalerts 2019-06-28 18:06:19 +02:00
Nedim Uka
b3baffe174 Send notification email 2019-06-27 17:29:57 +02:00
Nedim Uka
208faa08df Added send notification service, and queried unsent marketalerts, fixed some issues with crawler, and added proper logging 2019-06-25 17:07:02 +02:00
Bilal Catic
5ffdaef1bf Merge branch 'crawler-service' into 'master'
Crawler service

See merge request saburly/marketalarm/web!17
2019-06-24 14:09:47 +00:00
Nedim Uka
1aa91fb4e2 Fixed gardenSize 2019-06-24 15:34:59 +02:00
Nedim Uka
2cf6f6f1ff Code refactoring, fixed bug with price parsing: 2019-06-24 14:20:31 +02:00
Nedim Uka
6eba5c2a97 gardenSize nan 2019-06-24 11:49:13 +02:00
Nedim Uka
2f474619ca Compare crawler results with db, and only save new if necessary 2019-06-21 16:48:19 +02:00
Nedim Uka
80ff9bcb6b saving additional fields, improved async functions with promises 2019-06-21 15:14:43 +02:00
Nedim Uka
3c59292f23 refactoring 2019-06-20 21:27:51 +02:00
Nedim Uka
1bcc5e8e5d Preparing to save results to db 2019-06-20 14:51:14 +02:00
Nedim Uka
c8ee848f0e Improved results filtering by lat lng 2019-06-20 10:57:37 +02:00
Nedim Uka
0f630e9ea4 Olix crawling, filter crawling result by lat, lng 2019-06-19 17:12:22 +02:00
Nedim Uka
9a8a27d1d9 Scheduler 2019-06-18 15:05:40 +02:00
Nedim Uka
b17b6862ba Added migrations, expanded maketalert table 2019-06-18 14:01:09 +02:00
Nedim Uka
6aaaea1612 working on crawler 2019-06-13 15:49:31 +02:00
Nedim Uka
fdd0124924 Added crawler service 2019-06-13 13:31:35 +02:00
Nedim Uka
c15f45e8f4 Fixed map not loding bug 2019-06-12 15:20:58 +02:00
Nedim Uka
371eac900e Merge branch 'range-slider' into 'master'
Range slider

See merge request saburly/marketalarm/web!16
2019-06-12 11:37:15 +00:00
Nedim Uka
5d6e7f3938 fixed slider css overlaping 2019-06-12 13:36:49 +02:00
Nedim Uka
efda7fdccd Added nouiRange slider 2019-06-12 13:32:28 +02:00
Nedim Uka
8bb0908c45 Slider thumb fix 2019-06-11 16:22:17 +02:00
Bilal Catic
5c75d690b0 Merge branch 'slider-bug' into 'master'
Sliders bug

See merge request saburly/marketalarm/web!15
2019-06-11 11:21:33 +00:00
Nedim Uka
f0e8a72756 Sliders now returning to correct range if they go beyond allowed value 2019-06-11 11:44:59 +02:00
Bilal Catic
62bf3380cd Merge branch 'confirmation-email' into 'master'
Geocoding restricttions, added values for range finders, added confirmation email, and .env file

See merge request saburly/marketalarm/web!14
2019-06-11 08:42:06 +00:00
Nedim Uka
caa1871939 deleted env file 2019-06-11 10:34:48 +02:00
Nedim Uka
506ac67956 Fixed garden size email issues 2019-06-11 10:26:48 +02:00
Nedim Uka
8f9e3ae46a Geocoding restricttions, added values for range finders, added confirmation email, and .env file 2019-06-10 17:29:31 +02:00
Bilal Catic
d6e999fcf1 Merge branch 'double-email' into 'master'
Double email

See merge request saburly/marketalarm/web!13
2019-05-30 12:08:25 +00:00
Nedim Uka
08a94ca4f8 Fixed google maps bug, changed size, gardenSize, and price colum names, fixed bug with query review not showing default values 2019-05-30 10:43:47 +02:00
Nedim Uka
a0f2b044b2 Added validation to email confirmation 2019-05-29 17:10:41 +02:00
Nedim Uka
7db74acad7 Set range fileds to be integer instead of strings 2019-05-29 17:10:41 +02:00
Bilal Catic
56865b4670 Merge branch 'realestate-size-slider' into 'master'
Real Estate Slider

See merge request saburly/marketalarm/web!12
2019-05-29 10:18:17 +00:00
Nedim Uka
1a8ac3fba4 Added range slider to gardensize and price 2019-05-29 11:03:01 +02:00
Nedim Uka
de3c76315e Real Estate Slider 2019-05-28 16:46:38 +02:00
Bilal Catic
e969a8dc8b Merge branch 'edit-bug-fix' into 'master'
Fixed bug related to map region edit

See merge request saburly/marketalarm/web!11
2019-05-27 15:52:11 +00:00
Nedim Uka
f4baec23cf Fixed bug related to map region edit 2019-05-27 15:17:41 +02:00
Bilal Catic
5bf95e0594 Merge branch 'google-maps' into 'master'
Added google maps step

See merge request saburly/marketalarm/web!10
2019-05-27 08:35:04 +00:00
Nedim Uka
6fbacb326f Fixed bounding box bug, and removed unecesary params 2019-05-27 09:18:54 +02:00
Nedim Uka
be416ffc0c Added google maps step 2019-05-24 16:16:47 +02:00
Nedim Uka
a3d9a82fee Merge branch 'fix-minor-bugs' into 'master'
Fix minor bugs

See merge request saburly/marketalarm/web!9
2019-05-24 13:54:40 +00:00
Nedim Uka
6772f8a953 Merge branch 'enable-return-to-query-review-directly' into 'master'
Enable return to query review directly

See merge request saburly/marketalarm/web!8
2019-05-24 13:53:27 +00:00
Nedim Uka
89a3c9e355 Merge branch 'change-migrations-use-string-instead-of-enums' into 'master'
Change migrations - use string instead of enum

See merge request saburly/marketalarm/web!7
2019-05-24 13:50:55 +00:00
Bilal Catic
dd38602c5a add simple email validation 2019-05-22 16:57:08 +02:00
Bilal Catic
a3f76d20fe fix URL on send icon 2019-05-22 15:58:42 +02:00
Bilal Catic
fc1275566e handle undefined realEstateType 2019-05-22 13:19:27 +02:00
Bilal Catic
c64ee42914 Skip and prevent saving garden size if not needed 2019-05-22 11:36:01 +02:00
Bilal Catic
aa3c965d5c skip to query review directly when editing data 2019-05-21 15:32:47 +02:00
Bilal Catic
126da48852 modify realEstateRequest model to use String instead of enum 2019-05-21 15:26:53 +02:00
Bilal Catic
58ae430564 modify migrations - use string instead of enum 2019-05-21 15:26:53 +02:00
Senad Uka
315a29749c Update database configuration 2019-05-21 12:11:30 +02:00
Nedim Uka
02bee9cf2c Merge branch 'add-steps-to-wizard' into 'master'
Add steps to wizard

See merge request saburly/marketalarm/web!6
2019-05-21 09:39:43 +00:00
Bilal Catic
1c2847509a add final page 2019-05-19 19:45:19 +02:00
Bilal Catic
87dc742e41 add query submit page 2019-05-19 13:34:44 +02:00
Bilal Catic
70ddc1f734 add query review page 2019-05-19 12:29:55 +02:00
Bilal Catic
2c415bbd79 use enums from enum file 2019-05-19 10:03:52 +02:00
Bilal Catic
b07eb5bbeb fix available value input for size 2019-05-19 10:03:36 +02:00
Bilal Catic
53585d3ae1 use enums from enum file 2019-05-19 02:14:20 +02:00
Bilal Catic
c652a306db add price screen 2019-05-17 11:32:41 +02:00
Bilal Catic
b15295bfe6 add garden size screen 2019-05-17 11:12:24 +02:00
Bilal Catic
7ad1117cae add size screen 2019-05-17 11:06:32 +02:00
Nedim Uka
393f6731e6 Merge branch 'refactor' into 'master'
Refactor

See merge request saburly/marketalarm/web!5
2019-05-17 07:46:44 +00:00
Bilal Catic
93faa7c9e3 update readme 2019-05-17 09:14:16 +02:00
Bilal Catic
93f5d8071e add npm commands for docker and setup 2019-05-17 09:10:03 +02:00
Bilal Catic
7192c28c07 update readme 2019-05-17 08:55:36 +02:00
Bilal Catic
76f9457d4f add nodemon and migrate scripts 2019-05-17 08:49:01 +02:00
Bilal Catic
68172951ed change region and municipality property names to english 2019-05-17 00:52:43 +02:00
Bilal Catic
dbf40b199e Merge branch 'refactor' of https://gitlab.com/saburly/marketalarm/web into refactor 2019-05-17 00:34:13 +02:00
Bilal Catic
4309bc709d change column name from 'city' to 'region' 2019-05-17 00:33:10 +02:00
Bilal Catic
4323017d02 fix Readme 2019-05-16 21:34:32 +00:00
Bilal Catic
42505a7089 change column name from 'place' to 'municipality' 2019-05-16 23:32:18 +02:00
Bilal Catic
1542310a81 clean code 2019-05-16 19:58:48 +02:00
Bilal Catic
c505062770 change controller file name to plural 2019-05-16 19:42:15 +02:00
Bilal Catic
ab681e5eeb change file names to CamelCase 2019-05-16 19:40:26 +02:00
Bilal Catic
616eddbb19 improve Readme 2019-05-16 17:12:17 +02:00
Bilal Catic
e5eb6b99a2 Merge branch 'rename' into 'master'
Refactoring

See merge request saburly/marketalarm/web!4
2019-05-16 12:49:52 +00:00
Nedim Uka
27fa721627 Renaming to english 2019-05-16 13:00:08 +02:00
Senad Uka
9fdfce49ed Merge branch 'dockerize-database' into 'master'
Dockerize database

See merge request saburly/marketalarm/web!2
2019-04-30 12:07:09 +00:00
MirnaM
59723410b6 Update README 2019-04-30 09:47:50 +02:00
MirnaM
51ed3551c7 Use default postgres port 2019-04-30 09:19:52 +02:00
MirnaM
58177a8cce Add dockerfile 2019-04-30 09:06:46 +02:00
77 changed files with 5581 additions and 944 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
node_modules/
.env

11
Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
FROM postgres:11.3
ENV POSTGIS_MAJOR 2.4
RUN apt-get update \
&& apt-get --assume-yes install software-properties-common postgis\
&& rm -rf /var/lib/apt/lists/
RUN mkdir -p /docker-entrypoint-initdb.d
CMD ["postgres"]

View File

@@ -1,12 +1,43 @@
# web
# MarketAlert
The purpose of this project is to build a web application that enables subscribing to notifications when new products are published on various ad based marketplaces. The MVP will be only based on OLX.ba
## Setup
ENV:
JAWSDB_URL='mysql://sq4dlf9mz49avli0:gqy5vzmzyhp0837x@tuy8t6uuvh43khkk.cbetxkdyhwsb.us-east-1.rds.amazonaws.com:3306/rxhzg1550441ftqk'
### Setup with npm commands
Run with:
$ npm start
1. Install packages
`npm install`
2. Run setup script
`npm run setup`
this will create and run postgres image and then execute migrations
3. Run app
`npm start` to run app without restart on changes or
`npm run start-mon` to run app with automatic restart on code change
### Manual setup
1. Create postgres docker image
`docker build -t marketalerts .`
2. Run postgres image with
`docker run --name pg_marketalerts -d -p 5432:5432 marketalerts`
3. Install packages
`npm install`
4. Run migrations from `app` folder
`npm run migrate` or `npx sequelize db:migrate`
5. Run app
`npm start` or `npm run start-mon` to run app with automatic restart on code change
### AWS SES
- AWS SES credentials are handled with env vratiables
- Notification emails are sent in batches of 50, by using SES templates
- Make sure that you are using different templates for different envirorments

View File

@@ -1,11 +1,15 @@
{
"development": {
"use_env_variable": "JAWSDB_URL"
"username": "docker",
"password": "docker",
"database": "marketalerts",
"port": "5432",
"dialect": "postgres"
},
"test": {
"use_env_variable": "JAWSDB_URL"
"use_env_variable": "DATABASE_URL"
},
"production": {
"use_env_variable": "JAWSDB_URL"
"use_env_variable": "DATABASE_URL"
}
}

View File

@@ -1,7 +0,0 @@
const getDobrodosli = (req,res) => {
res.render('dobrodosli', { nextStep: '/vrstanekretnine' } );
}
module.exports = {
getDobrodosli
};

View File

@@ -0,0 +1,45 @@
const { currentRERequest } = require('../helpers/url');
const { getRealEstateTypeEnum } = require('../helpers/enums');
const getGardenSize = (req,res) => {
const title = "Koliko okućnice tražite ?"
const unit = " m2"
const rangeFrom = {
min : 10,
max : 3000,
value : 0,
step : 10
}
const rangeTo = {
min : 10,
max : 3000,
value : 100,
step : 10
}
res.render('gardenSize', { rangeFrom, rangeTo, unit, title });
};
const postGardenSize = async (req, res) => {
const request = await currentRERequest(req);
const nextStepPage = req.query.nextStep || 'cijena';
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
const realEstateType = getRealEstateTypeEnum(request.realEstateType);
if (realEstateType && realEstateType.hasGardenSize) {
request.gardenSizeMin = req.body.from;
request.gardenSizeMax = req.body.to;
await request.save();
}
res.redirect(nextStepUrl);
};
module.exports = {
getGardenSize,
postGardenSize
};

View File

@@ -0,0 +1,8 @@
const getGoAgain = async (req,res) => {
const title = "Želite li pretražiti još jednu nekretninu ?";
res.render('goAgain', {title});
};
module.exports = {
getGoAgain
};

View File

@@ -1,27 +0,0 @@
const db = require('../models/index');
const { currentRERequest } = require('../helpers/url');
const { regions } = require('../helpers/codes');
const gradovi = regions();
const getGrad = (req,res) => {
const nextStep = req.query.nextStep || '/';
res.render('grad', {
nextStep,
gradovi
});
}
const postGrad = async (req, res) => {
const request = await currentRERequest(req);
const nextStep = req.query.nextStep || `/mjesto/${request.uniqueId}`;
request.city = req.body.grad;
await request.save();
res.redirect(nextStep)
}
module.exports = {
getGrad,
postGrad
};

View File

@@ -1,26 +0,0 @@
const db = require('../models/index');
const { currentRERequest } = require('../helpers/url');
const { places } = require('../helpers/codes');
const getMjesto = async (req,res) => {
let request = await currentRERequest(req);
const mjesta = places(request.city);
const nextStep = req.query.nextStep || '/';
res.render('mjesto', {
nextStep,
mjesta
});
}
const postMjesto = async (req, res) => {
let request = await currentRERequest(req);
request.place = req.body.mjesto;
console.log("AAA ", req.body);
await request.save();
res.send("Result is " + JSON.stringify(request));
}
module.exports = {
getMjesto,
postMjesto
};

View File

@@ -0,0 +1,28 @@
const { currentRERequest } = require('../helpers/url');
const { getMunicipalitiesForRegion, getMunicipalityName } = require('../helpers/codes');
const getMunicipality = async (req, res) => {
const title = "U kojem mjestu tražite nekretninu?"
let request = await currentRERequest(req);
const municipalities = getMunicipalitiesForRegion(request.region);
res.render('municipality', { municipalities, title });
};
const postMunicipality = async (req, res) => {
const request = await currentRERequest(req);
const nextStepParam = req.query.nextStep ? "?nextStep=" + req.query.nextStep : "";
const nextStepUrl = `/${'naselje'}/${request.uniqueId}/${getMunicipalityName(request.region, req.body.municipality)}${nextStepParam}`;
request.municipality = req.body.municipality;
await request.save();
res.redirect(nextStepUrl);
};
module.exports = {
getMunicipality,
postMunicipality
};

View File

@@ -0,0 +1,41 @@
const { currentRERequest } = require('../helpers/url');
const getNeighborhood = async (req, res) => {
const title = "U kojem naselju tražite nekretninu?"
const municipality = req.params.municipality
const nextStep = req.query.nextStep || '/';
res.render('neighborhoodMap', {
nextStep,
municipality,
title
});
};
const postNeighborhood = async (req, res) => {
let request = await currentRERequest(req);
const northWest = [req.body.west, req.body.north];
const northEast = [req.body.east, req.body.north];
const southEast = [req.body.east, req.body.south];
const southWest = [req.body.west, req.body.south];
request.bounding_box = {
type: 'Polygon', coordinates: [
[northWest, northEast, southEast,
southWest, northWest]
]
};
await request.save();
const nextStepPage = req.query.nextStep || 'povrsina';
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
res.redirect(nextStepUrl);
};
module.exports = {
getNeighborhood,
postNeighborhood
};

42
app/controllers/prices.js Normal file
View File

@@ -0,0 +1,42 @@
const { currentRERequest } = require('../helpers/url');
const getPrice = (req,res) => {
const title = "Koja Vam okvirna cijena odgovara ?"
const unit = " KM"
const rangeFrom = {
min : 1000,
max : 250000,
value : 0,
step : 1000
}
const rangeTo = {
min : 1000,
max : 250000,
value : 50000,
step : 1000
}
res.render('price', {rangeFrom, rangeTo, unit, title });
};
const postPrice = async (req, res) => {
const request = await currentRERequest(req);
const nextStepPage = req.query.nextStep || 'pregled';
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
request.priceMin = req.body.from;
request.priceMax = req.body.to;
await request.save();
res.redirect(nextStepUrl);
};
module.exports = {
getPrice,
postPrice
};

View File

@@ -0,0 +1,88 @@
const { currentRERequest } = require('../helpers/url');
const { getRegionName, getMunicipalityName } = require('../helpers/codes');
const { realEstateTypes, sizes, gardenSizes, prices, getEnumTypeTitle, getRealEstateTypeEnum } = require('../helpers/enums');
const getQueryReview = async (req,res) => {
const title = "Da li je ovo to što ste tražili ?"
const request = await currentRERequest(req);
const nextStep = req.query.nextStep;
if (!request || !request.dataValues) {
return null;
}
const {
realEstateType,
region,
municipality,
sizeMin,
sizeMax,
gardenSizeMin,
gardenSizeMax,
priceMin,
priceMax } = request.dataValues;
const realEstateTypeObject = getRealEstateTypeEnum(realEstateType);
const enableGardenSizeEdit = realEstateTypeObject ? realEstateTypeObject.hasGardenSize : false;
const realEstateTypeTitle = realEstateType ? getEnumTypeTitle(realEstateTypes, realEstateType) : null;
const regionName = region ? getRegionName(region) : null;
const municipalityName = (region && municipality) ? getMunicipalityName(region, municipality) : null;
const sizeTitle = sizeMin ? sizeMin + "-" + sizeMax + " m2" : null;
const gardenSizeTitle = gardenSizeMin ? gardenSizeMin + "-" + gardenSizeMax + " m2" : null;
const priceTitle = priceMin ? priceMin + "-" + priceMax + " KM" : null;
const uniqueId = request.dataValues.uniqueId ? request.dataValues.uniqueId : '';
const queryData = [
{
id: 'realEstateType',
title: realEstateTypeTitle,
url: `/vrstanekretnine/${uniqueId}?nextStep=pregled`,
},
{
id: 'region',
title: regionName,
url: `/grad/${uniqueId}?nextStep=mjesto`,
},
{
id: 'municipality',
title: municipalityName,
url: `/mjesto/${uniqueId}?nextStep=pregled`,
},
{
id: 'size',
title: sizeTitle,
url: `/povrsina/${uniqueId}?nextStep=pregled`,
},
{
id: 'gardenSize',
title: gardenSizeTitle,
url: enableGardenSizeEdit ? `/okucnica/${uniqueId}?nextStep=pregled` : '',
},
{
id: 'price',
title: priceTitle,
url: `/cijena/${uniqueId}?nextStep=pregled`
}
];
res.render('queryReview', {
nextStep,
queryData,
title
});
};
const postQueryReview = async (req, res) => {
const request = await currentRERequest(req);
const nextStep = req.query.nextStep || `/posalji/${request.uniqueId}`;
res.redirect(nextStep);
};
module.exports = {
getQueryReview,
postQueryReview
};

View File

@@ -0,0 +1,54 @@
const { currentRERequest } = require('../helpers/url');
const { isValidEmail } = require('../helpers/email');
const { sendTemplatedEmail} = require('../helpers/awsEmail');
const getQuerySubmit = async (req, res) => {
const title = "Upišite vaš e-mail"
const nextStep = req.query.nextStep;
const error = req.query.error;
res.render('querySubmit', {
nextStep,
error,
title
});
};
const postQuerySubmit = async (req, res) => {
const request = await currentRERequest(req);
const nextStep = req.query.nextStep || '/ponovo';
const emailInput = req.body.email;
const emailConfirmInput = req.body.confirm;
let error = "Greška ! Unesite validan email";
if (!isValidEmail(emailInput) || !isValidEmail(emailConfirmInput)) {
error = "Greška ! Unesite validan email";
res.render('querySubmit', {
error
});
return;
}
if (emailInput !== emailConfirmInput) {
error = "Greška ! Unešeni emailovi nisu isti";
res.render('querySubmit', {
error
});
return;
}
request.email = req.body.email;
request.subscribed = true;
await request.save();
sendTemplatedEmail(req.body.email, request);
res.redirect(nextStep);
};
module.exports = {
getQuerySubmit,
postQuerySubmit
};

View File

@@ -0,0 +1,45 @@
const db = require('../models/index');
const { currentRERequest } = require('../helpers/url');
const { realEstateTypes, getRealEstateTypeEnum } = require('../helpers/enums');
const getRealEstateTypes = (req,res) => {
const title = "Koju nekretninu tražite?"
res.render('realEstateType', { realEstateTypes, title });
};
const postRealEstateTypes = async (req, res) => {
const request = await currentRERequest(req);
const nextStepPage = req.query.nextStep || 'grad';
if (request && request.uniqueId) {
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
request.realEstateType = req.body.realestatetype;
if (!getRealEstateTypeEnum(request.realEstateType).hasGardenSize){
request.gardenSize = null;
}
await request.save();
res.redirect(nextStepUrl)
} else {
db.RealEstateRequest.create({
realEstateType: req.body.realestatetype
}).then( (result) => {
const nextStepUrl = `/${nextStepPage}/${result.uniqueId}`;
res.redirect(nextStepUrl);
}).catch( (e) => {
res.send(e);
});
}
};
module.exports = {
getRealEstateTypes,
postRealEstateTypes
};

View File

@@ -0,0 +1,18 @@
const {allMarketAlertsByRequest} = require('../helpers/db/dbHelper');
const getRealEstates = async (req,res) => {
console.log("Enter get realestates");
const request = req.params['request_id'];
console.log(req.params['request_id']);
const realEstates = await allMarketAlertsByRequest(request);
console.log(realEstates);
const title = "Ovo su nekretnine koje smo pronašli za vas"
res.render('realEstates', {realEstates, title } );
};
module.exports = {
getRealEstates
};

View File

@@ -0,0 +1,28 @@
const { currentRERequest } = require('../helpers/url');
const { getRegions } = require('../helpers/codes');
const regions = getRegions();
const getRegion = (req,res) => {
const title = "U kojoj regiji tražite nekretninu?"
res.render('region', { regions, title });
};
const postRegion = async (req, res) => {
const request = await currentRERequest(req);
const nextStepQueryParam = req.query.nextStep ? '?nextStep=pregled' : '';
const nextStepPage = req.query.nextStep || 'mjesto';
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}${nextStepQueryParam}`;
request.region = req.body.region;
request.municipality = null;
await request.save();
res.redirect(nextStepUrl)
};
module.exports = {
getRegion,
postRegion
};

43
app/controllers/sizes.js Normal file
View File

@@ -0,0 +1,43 @@
const { currentRERequest } = require('../helpers/url');
const { sizes, getRealEstateTypeEnum } = require('../helpers/enums');
const getSize = (req,res) => {
const title = "Od koliko kvadrata tražite nekretninu ?"
const unit = " m2"
const rangeFrom = {
min : 10,
max : 250,
value : 0,
step : 10
}
const rangeTo = {
min : 10,
max : 250,
value : 50,
step : 10
}
res.render('size', { rangeFrom, rangeTo, unit, title });
};
const postSize = async (req, res) => {
const request = await currentRERequest(req);
const realEstateType = getRealEstateTypeEnum(request.realEstateType);
const nextStep = realEstateType && realEstateType.hasGardenSize ? 'okucnica' : 'cijena';
const nextStepPage = req.query.nextStep || nextStep;
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
request.sizeMin = req.body.from;
request.sizeMax = req.body.to;
await request.save();
res.redirect(nextStepUrl);
};
module.exports = {
getSize,
postSize
};

View File

@@ -0,0 +1,17 @@
const { currentRERequest } = require('../helpers/url');
const getUnsubscribe = async (req, res) => {
const title = "Uspješno ste se odjavili"
const request = await currentRERequest(req);
request.subscribed = false;
await request.save();
res.render('unsubscribe', { nextStep: '/vrstanekretnine', title });
};
module.exports = {
getUnsubscribe
};

View File

@@ -1,35 +0,0 @@
const db = require('../models/index');
const vrsteNekretnina = [
{ ime: "Kuća", id: "kuca" },
{ ime: "Stan", id: "stan" },
{ ime: "Vikendica", id: "vikendica" }
];
const getVrstaNekretnine = (req,res) => {
const nextStep = req.query.nextStep;
res.render('vrsta_nekretnine', {
nextStep,
vrste: vrsteNekretnina
});
}
const postVrstaNekretnine = (req, res) => {
let nextStep = req.query.nextStep;
db.RealEstateRequest.create({
realEstateType: req.body.vrsta
}).then( (result) => {
nextStep = nextStep || `/grad/${result.uniqueId}`;
res.redirect(nextStep);
}).catch( (e) => {
res.send(e);
});
}
module.exports = {
getVrstaNekretnine,
postVrstaNekretnine
};

View File

@@ -0,0 +1,8 @@
const getWelcome = (req,res) => {
const title = ""
res.render('welcome', { nextStep: '/vrstanekretnine', title } );
};
module.exports = {
getWelcome
};

253
app/helpers/awsEmail.js Normal file
View File

@@ -0,0 +1,253 @@
const dotenv = require('dotenv').config();
const { getRealEstateTypeEnum } = require('./enums');
const { getRegionName, getMunicipalityName } = require('./codes');
const { allRERequestByUiid } = require('./db/dbHelper');
var AWS = require('aws-sdk');
const TEMPLATE_NAME = process.env.AMAZON_NOTIFICATION_EMAIL_TEMPLATE;
const NUMBER_OF_RESULTS_TO_SHOW=10;
AWS.config.update({
region: process.env.AMAZON_REGION,
credentials:
{
accessKeyId: process.env.AMAZON_ACCES_KEY_ID,
secretAccessKey: process.env.AMAZON_SECRET_ACCESS_KEY
}
});
const sendTemplatedEmail = async (email, request) => {
const params = {
Destination: { /* required */
CcAddresses: [
],
ToAddresses: [
email
]
},
Message: { /* required */
Body: { /* required */
Html: {
Charset: "UTF-8",
Data: getGreetingsEmailHTML(request)
},
Text: {
Charset: "UTF-8",
Data: getGreetingsEmaiTextVersion(request)
}
},
Subject: {
Charset: 'UTF-8',
Data: `Javimi Potvrda: ${getSubject(request.realEstateType, request.region, request.municipality)}`
}
},
Source: process.env.SOURCE_EMAIL, /* required */
ReplyToAddresses: [
process.env.SOURCE_EMAIL,
],
};
const sendEmailPromise = new AWS.SES({ apiVersion: '2010-12-01' }).sendEmail(params).promise();
await sendEmailPromise;
}
const getGreetingsEmailHTML = (realestateRequest) => {
const realEstateType = getRealEstateTypeEnum(realestateRequest.realEstateType);
const gardenSize = realEstateType.hasGardenSize ? `<div><strong>Kvadratura okućnice: Od ${realestateRequest.gardenSizeMin} do ${realestateRequest.gardenSizeMax} m2 </strong></div>` : ``
return `<h1> Zdravo,
Naručio/la si da ti javimo ako se nekretnina pojavi u oglasima. </h1>
<h2> Ovo je tražena nekretnina: </h2>
<div>
<div> <strong>Tip nekretnine: ${realEstateType.title} </strong></div>
<div><strong>Područje: ${getRegionName(realestateRequest.region)} </strong></div>
<div><strong>Mjesto: ${getMunicipalityName(realestateRequest.region, realestateRequest.municipality)} </strong></div>
<div><strong>Kvadratura nekretnine: Od ${realestateRequest.sizeMin} do ${realestateRequest.sizeMax} m2 </strong></div>
${gardenSize}
<div><strong>Cijena: ${realestateRequest.priceMin} do ${realestateRequest.priceMax} KM </strong></div>
</div>
<div>
</div>
<div><strong> Ako želis prestati dobijati obavještenja za ovu pretragu klikni ${process.env.APP_URL}/odjava/${realestateRequest.uniqueId} </strong></div>
<div><strong>Ako želiš promijeniti uslove pretrage klikni ${process.env.APP_URL}/pregled/${realestateRequest.uniqueId} </strong></div>
<h4> Tvoj,
Javimi tim.
</h4>`
}
const getGreetingsEmaiTextVersion = (realestateRequest) => {
const realEstateType = getRealEstateTypeEnum(realestateRequest.realEstateType);
const gardenSize = realEstateType.hasGardenSize ? "Kvadratura okućnice od " + realestateRequest.gardenSizeMin + " do " + realestateRequest.gardenSizeMax : ""
const text = "Zdravo, \n Naručio/la si da ti javimo ako se nekretnina pojavi u oglasima \n Ovo je tražena nekretnina: \n , Tip nekretnine: "
+ realestateRequest.realEstateType + "\n Područje" + getRegionName(realestateRequest.region) + "\n Mjesto " + getMunicipalityName(realestateRequest.region, realestateRequest.municipality)
+ "\n Kvadratura nekretnine Od " + realestateRequest.sizeMin + " do " + realestateRequest.sizeMaX +
+ gardenSize
"\n Cijena od " + realestateRequest.priceMin + " do " + realestateRequest.priceMax +
"\n Ako želis prestati dobijati obavještenja za ovu pretragu klikni" + process.env.APP_URL + "/odjava/" + realestateRequest.uniqueId +
"\n Ako želiš promijeniti uslove pretrage klikni " + process.env.APP_URL + "/odpregled/" + realestateRequest.uniqueId +
"\n Tvoj,\n Javimi tim"
return text;
}
const sendBulkEmail = async (marketAlerts) => {
try {
destinations = []
groupedRERequests = [];
const RERequestUuidsMaped = marketAlerts.map(marketAlert => marketAlert.request);
const RERequestUuidsArray = Array.from(new Set(RERequestUuidsMaped));
const RERequestUuids = RERequestUuidsArray.map(marketAlert => {
return { uniqueId: marketAlert }
});
const RERequests = await allRERequestByUiid(RERequestUuids);
const requestDataValues = [];
RERequests.forEach(RERequest => {
var formatedRequest = {};
formatedRequest[RERequest.uniqueId] =
requestDataValues[RERequest.uniqueId] = {
realEstateType: RERequest.realEstateType,
region: RERequest.region,
municipality: RERequest.municipality,
requestUrl : `${process.env.APP_URL}/nekretnine/${RERequest.uniqueId}`
};
});
marketAlerts.forEach(marketAlert => {
const requestObject = {
email: marketAlert.email,
realEstateType: requestDataValues[marketAlert.request].realEstateType,
municipality: requestDataValues[marketAlert.request].municipality,
region: requestDataValues[marketAlert.request].region,
requestUrl: requestDataValues[marketAlert.request].requestUrl
}
if (!groupedRERequests[marketAlert.request]) {
groupedRERequests[marketAlert.request] = {
requestObject: requestObject,
marketAlertArray: []
};
}
groupedRERequests[marketAlert.request].marketAlertArray.push({
url: marketAlert.url,
title: marketAlert.title,
});
});
for (request in groupedRERequests) {
const marketAlert = groupedRERequests[request];
let extractedData = toAWSArray(marketAlert.marketAlertArray);
const realEstateType = getRealEstateTypeEnum(marketAlert.requestObject.realEstateType).title;
const region = getRegionName(marketAlert.requestObject.region);
const municipality = getMunicipalityName(marketAlert.requestObject.region, marketAlert.requestObject.municipality);
const requestUrl = marketAlert.requestObject.requestUrl
let repData = `{ "marketAlertUrl":[${extractedData}], "realestateType":"${realEstateType}", "region":"${region}", "municipality":"${municipality}", "requestUrl":"${requestUrl}" }`
destinations.push({
Destination: {
ToAddresses: [
marketAlert.requestObject.email
]
},
ReplacementTemplateData: repData
})
}
console.log("AWS EMAIL : Bulk email replacement data:");
console.log(destinations);
var params = {
Destinations:
destinations,
Source: process.env.SOURCE_EMAIL, /* required */
Template: TEMPLATE_NAME, /* required */
DefaultTemplateData: '{ \"REPLACEMENT_TAG_NAME\":\"REPLACEMENT_VALUE\" }',
ReplyToAddresses: [
process.env.SOURCE_EMAIL,
]
};
// Create the promise and SES service object
const sendPromise = new AWS.SES({ apiVersion: '2010-12-01' }).sendBulkTemplatedEmail(params).promise();
const awsResult = await sendPromise;
console.log("AWS SES bulk email response");
console.log(awsResult);
} catch (e) {
console.log("Could not send bulk email", e)
}
}
const toAWSArray = (urlArray) => {
let arrayString = ""
i = 0
urlArray.forEach(element => {
const formatetdTitle = element.title.replace(/"/g, "");
arrayString = i <= NUMBER_OF_RESULTS_TO_SHOW ? arrayString + `{"url":"${element.url.trim()}" , "title":"${formatetdTitle}"},` : arrayString;
console.log(i);
console.log(arrayString);
i++
});
return arrayString.slice(0, -1);
}
const getNotificationEmailHtml = () => {
return `<h2> Zdravo,
Pronašli smo nekretninu koju ste tražili. </h2>
<h3> Ovo su tražene nekretnine: </h3>
<div>
<div>{{#each marketAlertUrl}}<li><a href="{{url}}">{{title}}</a></li><br />{{/each}}<div/>
<div/>
<div>Kompletan spisak nekretnina možete pegledati ovdije: <a href="{{requestUrl}}">Nekretnine</a> <div>
</div>`
}
const getNotificationEmailText = () => {
return ` Zdravo,
Pronašli smo nekretninu koju ste tražili. Ovo su tražene nekretnine: {{#each marketAlertUrl}} {{url}} {{title}} {{/each}} , Kompletan spisan nekretnina mozete pegledati ovdije: {{requestUrl}}`
}
const createMarketAlertEmailTemplate = async () => {
const marketAlertTemplate = {
Template: {
TemplateName: TEMPLATE_NAME,
SubjectPart: "Javi mi obavijest: {{realestateType}}, {{region}}, {{municipality}}",
TextPart: getNotificationEmailText(),
HtmlPart: getNotificationEmailHtml()
}
}
try {
const templatePromise = new AWS.SES({ apiVersion: '2010-12-01' }).updateTemplate(marketAlertTemplate).promise();
await templatePromise
} catch (e) {
console.log("Could not create MarketAlertEmailTemplate", e);
}
}
const getSubject = (realEstateType, region, municipality) => {
return `${getRealEstateTypeEnum(realEstateType).title} ${getRegionName(region)}, ${getMunicipalityName(region, municipality)}`
}
module.exports = {
sendTemplatedEmail,
sendBulkEmail,
createMarketAlertEmailTemplate
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,375 @@
const fetch = require('node-fetch');
const cheerio = require('cheerio');
const { allRERequest, findPointInsideBoundingBox } = require('../db/dbHelper');
const { getRealEstateTypeEnum } = require('../enums');
const { getRegion, getMunicipality } = require('../codes')
const Promise = require("bluebird");
module.exports = class OlxCrawler {
//TODO figure best way to handle paging
constructor(hrefs = []) {
this.hrefs = hrefs;
}
async indexPages(urls) {
const indexers = [];
urls.forEach(url => {
indexers.push(new Indexer(url));
});
return Promise.map(indexers, function (indexer) {
return indexer.indexWithPagination();
}).then(async (results) => {
return results
})
}
async crawl() {
console.log("OLX CRAWLER: start crawl");
const filteredResults = [];
const realestateRequests = await allRERequest();
console.log("OLX CRAWLER: found " + realestateRequests.length + "subscribed RealEstateRequests");
const urls = this.createRequestUrls(realestateRequests);
let results = await this.indexPages(urls, this.fromPage, this.toPage, this.maxResults);
console.log("Final crawler results");
const flatResults = results.flat();
console.log(flatResults);
if (flatResults) {
console.log(flatResults.length);
for (const finalResult of flatResults) {
if (null !== finalResult) {
if (finalResult.lat !== undefined && finalResult.lat !== null && finalResult.lat !== "") {
const pointInsideBoundingBox = await findPointInsideBoundingBox([finalResult.lng, finalResult.lat], finalResult.email, finalResult.uuid);
if (pointInsideBoundingBox[0].length !== 0) {
finalResult.hasLocation = true
filteredResults.push(finalResult);
} else {
finalResult.hasLocation = false
filteredResults.push(finalResult);
}
}
}
}
console.log("OLX CRAWLER: number of olx crawler results, after geo location filtering: " + filteredResults.length);
return filteredResults;
}
return []
}
createRequestUrls(realestateRequests) {
const urls = []
for (const request of realestateRequests) {
const realsestateType = "kategorija=" + getRealEstateTypeEnum(request.realEstateType).olxCategory;
const region = "kanton=" + getRegion(request.region).olxid;
const municipality = "grad%5B%5D=" + getMunicipality(request.region, request.municipality).olxid;
const sizeMin = "kvadrata_min=" + request.sizeMin;
const sizeMax = "kvadrata_max=" + request.sizeMax;
const priceMin = "od=" + request.priceMin;
const priceMax = "do=" + request.priceMax;
const olxUrl = {
url: `https://www.olx.ba/pretraga?${realsestateType}&id=2&stanje=0&vrstapregleda=tabela&sort_order=desc&${region}&${municipality}&${priceMin}&${priceMax}&vrsta=samoprodaja&${sizeMin}&${sizeMax}&stranica=`,
email: request.email,
uuid: request.uniqueId,
hrefs: this.hrefs
}
console.log(olxUrl.url);
urls.push(olxUrl);
}
return urls;
}
};
class Indexer {
/**
*
* @param {String|Array} olxUrl single or array of objects containing url email and uuid
* @param {Array} hrefResutls array contaning urls from crawler results
*/
constructor(olxUrl, hrefResutls) {
this.olxUrl = olxUrl;
this.hrefResutls = hrefResutls;
}
async indexWithPagination(pageNumber = 1) {
console.log("This is olxUrl:" + this.olxUrl.url);
const pageNr = this.olxUrl.url.match(/\d+$/);
const indexers = this.prepareIndexers(pageNumber ? [pageNumber] : pageNr);
try {
return Promise.map(indexers.indexers, function (indexer) {
return indexer.indexPage(pageNumber);
}).then(async (results) => {
let hasResults = false;
results.forEach(result => {
if (!hasResults) {
console.log("No results detected")
hasResults = result.hasResults
}
});
if (!hasResults) {
console.log("HAS NO MORE RESULTS, stop the paging, there are some results and they should contain only HREFS");
console.log(results.length);
const singlePageIndexers = this.prepareHrefIndexers(results);
if (singlePageIndexers.length === 0) {
console.log("THERE IS NOT EVEN SINGLE RESULT");
return []
}
return Promise.map(singlePageIndexers, function (indexer) {
return indexer.indexSingle();
}).then(async (results) => {
console.log("SinglePageMethod in HAS NO RESULTS, MarketAralms");
console.log(results.length);
return results;
});
} else {
console.log("HAS MORE RESULTS, should only contain HREFS");
console.log(results.length);
const newResults = await this.indexWithPagination(results[0].pageNumber + 5);
const singlePageIndexers = this.prepareHrefIndexers(results);
const newerResults = await Promise.map(singlePageIndexers, function (indexer) {
return indexer.indexSingle();
}).then(async (results) => {
console.log("SinglePageMethod HAS RESULTS, should contain MarketAlerts only");
console.log(results.length);
return results;
});
Array.prototype.push.apply(newResults, newerResults);
return newResults;
}
});
} catch (e) {
console.error("Error has accured", e);
}
}
prepareIndexers(pageNr) {
console.log("Entering prepareIndexers : page nr - " + pageNr);
const indexers = [];
let lastPageNumber;
if (pageNr) {
for (let index = Number(pageNr[0]); index <= Number(pageNr[0]) + 5; index++) {
lastPageNumber = index;
const newOlxUrl = {
url: this.olxUrl.url.replace(/\d+$/, "") + index,
email: this.olxUrl.email,
uuid: this.olxUrl.uuid,
hrefs: this.olxUrl.hrefs
}
indexers.push(new Indexer(newOlxUrl));
}
} else {
for (let index = 1; index <= 5; index++) {
lastPageNumber = index;
const newOlxUrl = {
url: this.olxUrl.url + index,
email: this.olxUrl.email,
uuid: this.olxUrl.uuid,
hrefs: this.olxUrl.hrefs
}
indexers.push(new Indexer(newOlxUrl));
}
}
return {
indexers: indexers,
lastPageNumber: lastPageNumber
};
}
prepareHrefIndexers(results) {
const indexers = []
if (!Array.isArray(results)) {
results.hrefs.forEach(href => {
const newOlxUrl = {
url: href,
email: results.olxUrl.email,
uuid: results.olxUrl.uuid,
hrefs: this.olxUrl.hrefs
}
indexers.push(new Indexer(newOlxUrl));
});
} else {
results.forEach(result => {
if (result !== null && result.hasOwnProperty('hrefs')) {
result.hrefs.forEach(href => {
const newOlxUrl = {
url: href,
email: result.olxUrl.email,
uuid: result.olxUrl.uuid,
hrefs: this.olxUrl.hrefs
}
indexers.push(new Indexer(newOlxUrl));
})
}
});
}
return indexers;
}
async indexPage(pageNumber) {
console.log("Page number in index page, max page number :")
console.log(pageNumber);
try {
console.log("Indexing page: " + this.olxUrl.url);
const res = await fetch(this.olxUrl.url);
const body = await res.text();
const $ = cheerio.load(body);
const hrefs = [];
let hasResults = false
$('#rezultatipretrage').find('.listitem').each((i, elem) => {
hasResults = true
const href = $(elem).find('a').first().attr('href');
hrefs.push(href);
});
console.log("this is hrefs for olxUrl" + this.olxUrl.url);
console.log("NUMBER OF HREFS " + hrefs.length);
return {
hrefs: hrefs,
hasResults: hasResults,
pageNumber: pageNumber,
olxUrl: this.olxUrl
}
} catch (e) {
console.error('Exception caught:' + e);
}
}
async indexSingle() {
try {
console.log("Index single");
console.log(this.olxUrl.url);
if (this.olxUrl.url === undefined) {
return {}
}
// if (global.hrefs) {
if (this.olxUrl.hrefs[this.olxUrl.uuid] && this.olxUrl.hrefs[this.olxUrl.uuid].includes(this.olxUrl.url)) {
console.log("We found duplicate URL");
return null
}
// }
const res = await fetch(this.olxUrl.url);
const body = await res.text();
const $ = cheerio.load(body);
const title = $('#naslovartikla').text().trim();
const realEstateType = $('#artikal_glavni_div > div.artikal_lijevo > div:nth-child(3) > div > span:nth-child(3) > a > span').text();
const price = $('#pc > p:nth-child(2)').text();
const size = $('#dodatnapolja1 > div:nth-child(1) > div.df2').text();
const rooms = $('#dodatnapolja1 > div:nth-child(2) > div.df2').text();
const address = $('#dodatnapolja1 > div:nth-child(5) > div.df2').text();
const gardenSize = $('#dodatnapolja1 > div:nth-child(6) > div.df2').text();
const location = $('#artikal_glavni_div > div.artikal_lijevo > div.op.pop.mobile-lokacija').attr('data-content');
const time = $('time').attr('datetime');
const olxId = $('#artikal_glavni_div > div.artikal_lijevo > div:nth-child(15) > div:nth-child(4) > div.df2').text();
const descriptions = $('.artikal_detaljniopis_tekst');
const latLngRe = /LatLng\(([0-9]+\.[0-9]+)\,\s+([0-9]+\.[0-9]+)\)/g;
const imgRe = /href":("[^"]*")/g;
const matches = latLngRe.exec(body);
let lng = '',
lat = '';
const parsePrice = (price) => parseFloat(price.replace(".", ""))
if (matches && matches.length >= 3) {
lat = matches[1];
lng = matches[2];
}
const parsedPrice = parsePrice(price);
const locationArray = location.split(",");
const region = locationArray[0];
const municipality = locationArray[1];
const data = {
realEstateType: this.getCategoryId(realEstateType),
email: this.olxUrl.email,
uuid: this.olxUrl.uuid,
olxId: olxId,
url: this.olxUrl.url,
title,
price: isNaN(parsedPrice) ? 0 : parsedPrice,
size: parseFloat(size),
gardenSize: isNaN(parseFloat(gardenSize)) ? 0 : parseFloat(gardenSize),
address,
region,
municipality,
time,
shortDescription: descriptions.first().text(),
longDescription: descriptions.last().text(),
lat,
lng,
loc: [parseFloat(lat), parseFloat(lng)],
};
return data;
} catch (e) {
console.error('Exception caught: ' + e.message);
}
return null;
}
getCategoryId(category) {
switch (category) {
case 'Stanovi':
return 'stan';
case 'Vikendice':
return 'vikendica'
case 'Kuće':
return 'kuca';
default:
return '';
}
}
}

View File

@@ -0,0 +1,90 @@
const db = require('../../models/index');
/**
* Find all subscribed RealEstateRequests
*/
const allRERequest = async () => {
return await db.RealEstateRequest.findAll({
where: {
subscribed: true
}
});
}
/**
* Find all subscribed RealEstateRequests by UUID
*/
const allRERequestByUiid = async (requestArray) => {
const Op = db.Sequelize.Op;
return await db.RealEstateRequest.findAll({
where: {
subscribed: true,
[Op.or]: requestArray
}
});
}
/**
* Find all , or all depending on notified bolean marketalerts, that the hasLocation is true, and order them by email
*
* @param fechAll bolean
* @param notified bolean
*
* @returns array of MarketAlerts
*/
const allMarketAlerts = async (fetchAll, notified) => {
let queryObject = {
order: [
['email', 'DESC'],
]
}
if (!fetchAll){
queryObject.where = {
notified: notified,
hasLocation: true
}
}
return await db.MarketAlert.findAll(queryObject);
}
/**
* Find all , MarketAlerts depending on request
*
* @param request string
*
* @returns array of MarketAlerts
*/
const allMarketAlertsByRequest = async (request) => {
let queryObject = {
where : {
request: request
}
}
return await db.MarketAlert.findAll(queryObject);
}
/**
* Find all unnotified marketalerts
* @param latLng array
* @param email string
*
* @returns array of MarketAlerts
*/
const findPointInsideBoundingBox = async (latLng, email, uniqueId) => {
return await db.sequelize.query(`SELECT * FROM "RealEstateRequests" WHERE email = '${email}' AND "uniqueId" = '${uniqueId}' AND subscribed = true AND ST_Contains("RealEstateRequests".bounding_box, ST_GEOMFROMTEXT('POINT (${latLng[0]} ${latLng[1]})'))`);
}
module.exports = {
allRERequest,
allMarketAlerts,
allRERequestByUiid,
findPointInsideBoundingBox,
allMarketAlertsByRequest
};

9
app/helpers/email.js Normal file
View File

@@ -0,0 +1,9 @@
const isValidEmail = (email) => {
const simpleEmailRegex = /^.+@.+\..+$/;
return (email && email.length < 250 && simpleEmailRegex.test(email));
};
module.exports = {
isValidEmail
};

57
app/helpers/enums.js Normal file
View File

@@ -0,0 +1,57 @@
const realEstateTypes = [
{ title: "Kuća", id: "kuca", hasGardenSize: true, olxCategory: 24 },
{ title: "Stan", id: "stan", hasGardenSize: false, olxCategory: 23},
{ title: "Vikendica", id: "vikendica", hasGardenSize: true, olxCategory: 26 }
];
const sizes = [
{ title: "do 50 m2", id: "50m2" },
{ title: "do 75 m2", id: "75m2" },
{ title: "do 100 m2", id: "100m2" },
{ title: "do 150 m2", id: "150m2" },
{ title: "do 200 m2", id: "200m2" },
{ title: "preko 200 m2", id: "moreThan200m2" }
];
const gardenSizes = [
{ title: "do 100 m2", id: "100m2" },
{ title: "do 500 m2", id: "500m2" },
{ title: "do 1 dunum", id: "1000m2" },
{ title: "do 2 dunuma", id: "2000m2" },
{ title: "do 3 dunuma", id: "3000m2" },
{ title: "preko 3 dunuma", id: "moreThan3000m2" }
];
const prices = [
{ title: "do 50 000 KM", id: "50kKM" },
{ title: "do 100 000 KM", id: "100kKM" },
{ title: "do 150 000 KM", id: "150kKM" },
{ title: "do 200 000 KM", id: "200kKM" },
{ title: "do 250 000 KM", id: "250kKM" },
{ title: "preko 250 000 KM", id: "moreThan250kKM" }
];
const getEnumObject = (enumType, enumId) => {
return enumType.find(enumValue => enumValue.id === enumId);
};
const getRealEstateTypeEnum = (enumId) => {
return getEnumObject(realEstateTypes, enumId) || null;
}
const getEnumTypeTitle = (enumType, enumId) => {
const enumObject = getEnumObject(enumType, enumId);
if (!enumObject){
return null;
}
return enumObject.title;
};
module.exports = {
realEstateTypes,
sizes,
gardenSizes,
prices,
getRealEstateTypeEnum,
getEnumTypeTitle,
};

View File

@@ -5,10 +5,8 @@ const currentRERequest = async (req) => {
if(!uniqueId) return null;
const request = await db.RealEstateRequest.findOne({ where: {uniqueId} });
console.log("Request ", request);
return request;
}
};
module.exports = {
currentRERequest
}
currentRERequest,
};

View File

@@ -1,8 +1,10 @@
const convertToDate = require("./convertToDate");
function areThereAnyNewItems(lastItemDate, controlDate) {
if (!lastItemDate) {
return true;
}
return new Date(controlDate) < convertToDate(lastItemDate);
}
module.exports = areThereAnyNewItems;

View File

@@ -1,6 +1,6 @@
let fetch = require("node-fetch");
let cheerio = require("cheerio");
const areThereAnyNewItems = require("./arethereanynewitems");
const areThereAnyNewItems = require("./areThereAnyNewItems");
async function scrapTheItems(url, controlDate, noNewItems = false) {
let items = [];

View File

@@ -1,11 +1,11 @@
const scrapTheItems = require("./scraptheitems");
const scrapTheItems = require("./scrapTheItems");
const convertToDate = require("./convertToDate");
const AWS = require('aws-sdk');
AWS.config.update({region: 'eu-central-1'});
// AWS.config.update({region: 'eu-central-1'});
async function sendNotification(marketAlert) {
const { id, email, olx_url, last_date } = marketAlert;
const { id, email, olx_url } = marketAlert;
let url =
"https://www.olx.ba/pretraga?" + olx_url + "&sort_order=desc&sort_po=datum";
let newItems = await scrapTheItems(url);
@@ -17,8 +17,8 @@ async function sendNotification(marketAlert) {
""
);
// Create sendEmail params
var params = {
// Create sendEmail params
const params = {
Destination: { /* required */
CcAddresses: [
],
@@ -50,7 +50,7 @@ async function sendNotification(marketAlert) {
if (message) {
const sendPromise = new AWS.SES({apiVersion: '2010-12-01'}).sendEmail(params).promise();
await sendPromise;
await sendPromise;
return { id, date: String(convertToDate(lastDate)) };
}
}

View File

@@ -12,8 +12,7 @@ module.exports = {
type: Sequelize.UUID
},
realEstateType: {
type: Sequelize.ENUM,
values: ['kuca','stan','vikendica','plac','poslovni_prostor','apartman','garaza']
type: Sequelize.STRING
},
email: {
type: Sequelize.STRING

View File

@@ -0,0 +1,19 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.renameColumn(
'RealEstateRequests',
'place',
'municipality'
);
},
down: (queryInterface, Sequelize) => {
return queryInterface.renameColumn(
'RealEstateRequests',
'municipality',
'place'
);
}
};

View File

@@ -0,0 +1,19 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.renameColumn(
'RealEstateRequests',
'city',
'region'
);
},
down: (queryInterface, Sequelize) => {
return queryInterface.renameColumn(
'RealEstateRequests',
'region',
'city'
);
}
};

View File

@@ -0,0 +1,20 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn(
'RealEstateRequests',
'size',
{
type: Sequelize.STRING
}
);
},
down: (queryInterface, Sequelize) => {
return queryInterface.removeColumn(
'RealEstateRequests',
'size'
);
}
};

View File

@@ -0,0 +1,20 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn(
'RealEstateRequests',
'gardenSize',
{
type: Sequelize.STRING
}
);
},
down: (queryInterface, Sequelize) => {
return queryInterface.removeColumn(
'RealEstateRequests',
'gardenSize'
);
}
};

View File

@@ -0,0 +1,20 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn(
'RealEstateRequests',
'price',
{
type: Sequelize.STRING
}
);
},
down: (queryInterface, Sequelize) => {
return queryInterface.removeColumn(
'RealEstateRequests',
'price'
);
}
};

View File

@@ -0,0 +1,15 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.sequelize.query("CREATE EXTENSION postgis").then(([results, metadata]) => {
/// No result
})
},
down: (queryInterface, Sequelize) => {
return queryInterface.sequelize.query("DROP EXTENSION IF EXISTS postgis").then(([results, metadata]) => {
/// No result
})
}
};

View File

@@ -0,0 +1,17 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.sequelize.query("ALTER TABLE \"RealEstateRequests\" ADD COLUMN bounding_box geometry(Polygon);").then(([results, metadata]) => {
/// No result
})
},
down: (queryInterface, Sequelize) => {
return queryInterface.sequelize.query("ALTER TABLE \"RealEstateRequests\" DROP COLUMN bounding_box").then(([results, metadata]) => {
/// No result
})
}
};

View File

@@ -0,0 +1,27 @@
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) => {
return Promise.all([
queryInterface.addColumn('RealEstateRequests', 'sizeRange', {
type: Sequelize.STRING
}, { transaction: t }),
queryInterface.addColumn('RealEstateRequests', 'gardenSizeRange', {
type: Sequelize.STRING,
}, { transaction: t }),
queryInterface.addColumn('RealEstateRequests', 'priceRange', {
type: Sequelize.STRING,
}, { transaction: t })
])
})
},
down: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) => {
return Promise.all([
queryInterface.removeColumn('RealEstateRequests', 'sizeRange', { transaction: t }),
queryInterface.removeColumn('RealEstateRequests', 'gardenSizeRange', { transaction: t }),
queryInterface.removeColumn('RealEstateRequests', 'priceRange', { transaction: t })
])
})
}
};

View File

@@ -0,0 +1,63 @@
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) => {
return Promise.all([
queryInterface.removeColumn('RealEstateRequests', 'sizeRange', { transaction: t }),
queryInterface.removeColumn('RealEstateRequests', 'gardenSizeRange', { transaction: t }),
queryInterface.removeColumn('RealEstateRequests', 'priceRange', { transaction: t }),
queryInterface.removeColumn('RealEstateRequests', 'size', { transaction: t }),
queryInterface.removeColumn('RealEstateRequests', 'gardenSize', { transaction: t }),
queryInterface.removeColumn('RealEstateRequests', 'price', { transaction: t }),
queryInterface.addColumn('RealEstateRequests', 'gardenSizeMin', {
type: Sequelize.INTEGER,
}, { transaction: t }),
queryInterface.addColumn('RealEstateRequests', 'gardenSizeMax', {
type: Sequelize.INTEGER,
}, { transaction: t }),
queryInterface.addColumn('RealEstateRequests', 'sizeMin', {
type: Sequelize.INTEGER
}, { transaction: t }),
queryInterface.addColumn('RealEstateRequests', 'sizeMax', {
type: Sequelize.INTEGER,
}, { transaction: t }),
queryInterface.addColumn('RealEstateRequests', 'priceMin', {
type: Sequelize.INTEGER,
}, { transaction: t }),
queryInterface.addColumn('RealEstateRequests', 'priceMax', {
type: Sequelize.INTEGER
}, { transaction: t })
])
})
},
down: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) => {
return Promise.all([
queryInterface.removeColumn('RealEstateRequests', 'gardenSizeMin', { transaction: t }),
queryInterface.removeColumn('RealEstateRequests', 'gardenSizeMax', { transaction: t }),
queryInterface.removeColumn('RealEstateRequests', 'sizeMin', { transaction: t }),
queryInterface.removeColumn('RealEstateRequests', 'sizeMax', { transaction: t }),
queryInterface.removeColumn('RealEstateRequests', 'priceMin', { transaction: t }),
queryInterface.removeColumn('RealEstateRequests', 'priceMin', { transaction: t }),
queryInterface.addColumn('RealEstateRequests', 'priceMax', {
type: Sequelize.STRING
}, { transaction: t }),
queryInterface.addColumn('RealEstateRequests', 'gardenSizeRange', {
type: Sequelize.STRING,
}, { transaction: t }),
queryInterface.addColumn('RealEstateRequests', 'priceRange', {
type: Sequelize.STRING,
}, { transaction: t }),
queryInterface.addColumn('RealEstateRequests', 'size', {
type: Sequelize.STRING
}, { transaction: t }),
queryInterface.addColumn('RealEstateRequests', 'gardenSize', {
type: Sequelize.STRING,
}, { transaction: t }),
queryInterface.addColumn('RealEstateRequests', 'price', {
type: Sequelize.STRING,
}, { transaction: t })
])
})
}
};

View File

@@ -0,0 +1,18 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn(
'RealEstateRequests',
'subscribed',
Sequelize.BOOLEAN
);
},
down: (queryInterface, Sequelize) => {
return queryInterface.removeColumn(
'RealEstateRequests',
'subscribed'
);
}
};

View File

@@ -0,0 +1,37 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) => {
return Promise.all([
queryInterface.addColumn('MarketAlerts', 'size', {
type: Sequelize.INTEGER,
}, { transaction: t }),
queryInterface.addColumn('MarketAlerts', 'gardenSize', {
type: Sequelize.INTEGER,
}, { transaction: t }),
queryInterface.addColumn('MarketAlerts', 'price', {
type: Sequelize.INTEGER,
}, { transaction: t }),
queryInterface.addColumn('MarketAlerts', 'municipality', {
type: Sequelize.STRING,
}, { transaction: t }),
queryInterface.addColumn('MarketAlerts', 'region', {
type: Sequelize.STRING,
}, { transaction: t })
])
})
},
down: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) => {
return Promise.all([
queryInterface.removeColumn('MarketAlerts', 'size', { transaction: t }),
queryInterface.removeColumn('MarketAlerts', 'gardenSize', { transaction: t }),
queryInterface.removeColumn('MarketAlerts', 'price', { transaction: t }),
queryInterface.removeColumn('MarketAlerts', 'municipality', { transaction: t }),
queryInterface.removeColumn('MarketAlerts', 'region', { transaction: t })
])
})
}
};

View File

@@ -0,0 +1,33 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) => {
return Promise.all([
queryInterface.removeColumn('MarketAlerts', 'olxUrl', { transaction: t }),
queryInterface.addColumn('MarketAlerts', 'url', {
type: Sequelize.STRING,
}, { transaction: t }),
queryInterface.addColumn('MarketAlerts', 'realestateOrigin', {
type: Sequelize.STRING,
}, { transaction: t }),
queryInterface.addColumn('MarketAlerts', 'originId', {
type: Sequelize.STRING,
}, { transaction: t })
])
})
},
down: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) => {
return Promise.all([
queryInterface.removeColumn('MarketAlerts', 'url', { transaction: t }),
queryInterface.removeColumn('MarketAlerts', 'realestateOrigin', { transaction: t }),
queryInterface.removeColumn('MarketAlerts', 'originId', { transaction: t }),
queryInterface.addColumn('MarketAlerts', 'olxUrl', {
type: Sequelize.STRING
}, { transaction: t })
])
})
}
};

View File

@@ -0,0 +1,20 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn(
'MarketAlerts',
'realEstateType',
{
type: Sequelize.STRING
}
);
},
down: (queryInterface, Sequelize) => {
return queryInterface.removeColumn(
'MarketAlerts',
'realEstateType'
);
}
};

View File

@@ -0,0 +1,20 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn(
'MarketAlerts',
'notified',
{
type: Sequelize.BOOLEAN
}
);
},
down: (queryInterface, Sequelize) => {
return queryInterface.removeColumn(
'MarketAlerts',
'notified'
);
}
};

View File

@@ -0,0 +1,20 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn(
'MarketAlerts',
'title',
{
type: Sequelize.STRING
}
);
},
down: (queryInterface, Sequelize) => {
return queryInterface.removeColumn(
'MarketAlerts',
'title'
);
}
};

View File

@@ -0,0 +1,20 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn(
'MarketAlerts',
'request',
{
type: Sequelize.STRING
}
);
},
down: (queryInterface, Sequelize) => {
return queryInterface.removeColumn(
'MarketAlerts',
'request'
);
}
};

View File

@@ -0,0 +1,20 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn(
'MarketAlerts',
'hasLocation',
{
type: Sequelize.BOOLEAN
}
);
},
down: (queryInterface, Sequelize) => {
return queryInterface.removeColumn(
'MarketAlerts',
'hasLocation'
);
}
};

View File

@@ -1,8 +1,21 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const MarketAlert = sequelize.define('MarketAlert', {
olxUrl: DataTypes.STRING,
url: DataTypes.STRING,
realestateOrigin: DataTypes.STRING,
originId: DataTypes.STRING,
lastDate: DataTypes.STRING,
size : DataTypes.INTEGER,
gardenSize : DataTypes.INTEGER,
price : DataTypes.INTEGER,
municipality : DataTypes.STRING,
region : DataTypes.STRING,
realEstateType : DataTypes.STRING,
notified : DataTypes.BOOLEAN,
title : DataTypes.STRING,
request: DataTypes.STRING,
hasLocation: DataTypes.BOOLEAN,
email: {
type: DataTypes.STRING,
allowNul: false

View File

@@ -1,18 +1,25 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const RealEstateRequest = sequelize.define('RealEstateRequest', {
uniqueId: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
allowNull: false
},
realEstateType: {
type: DataTypes.ENUM,
values: ['kuca','stan','vikendica','plac','poslovni_prostor','apartman','garaza']
},
email: DataTypes.STRING,
city: DataTypes.STRING,
place: DataTypes.STRING,
realEstateType: DataTypes.STRING,
email: DataTypes.STRING,
region: DataTypes.STRING,
municipality: DataTypes.STRING,
sizeMin: DataTypes.INTEGER,
sizeMax: DataTypes.INTEGER,
gardenSizeMin: DataTypes.INTEGER,
gardenSizeMax: DataTypes.INTEGER,
priceMin: DataTypes.INTEGER,
priceMax: DataTypes.INTEGER,
bounding_box: DataTypes.GEOMETRY('POINT', 4326),
subscribed: DataTypes.BOOLEAN
}, {});
RealEstateRequest.associate = function(models) {
// associations can be defined here

View File

@@ -1,11 +1,52 @@
.dobrodosli-center-button {
.welcome-center-button {
width: 100%;
}
.dobrodosli-big-logo {
.next-center-button {
width: 50%;
left: 25%;
}
.welcome-big-logo {
font-size: 200pt;
background-image: url(./images/logo.png);
background-size: contain;
background-repeat: no-repeat;
color: rgba(0, 0, 0, 0);
}
.no-ui-slider {
width: 95%
}
.centered-element {
margin-top: 200px;
}
.centered-element-small {
margin-top: 100px;
}
#map {
height: 50%;
}
html,
body {
height: 100%;
}
#floating-panel {
top: 10px;
left: 25%;
z-index: 5;
background-color: #fff;
padding: 5px;
border: 1px solid #999;
text-align: center;
font-family: 'Roboto', 'sans-serif';
line-height: 30px;
padding-left: 10px;
}

View File

@@ -0,0 +1,85 @@
const Promise = require("bluebird");
const OlxCrawler = require("../helpers/crawlers/olxClawler");
const db = require("../models/index");
const { allMarketAlerts } = require('../helpers/db/dbHelper');
async function crawlAll() {
console.log("CRAWLER SERVICE: crawlAll");
try {
const marketAlertsFromDb = await allMarketAlerts(true);
const hrefs = [];
marketAlertsFromDb.map(marketAlert => {
if (hrefs[marketAlert.request] === undefined) {
hrefs[marketAlert.request] = []
}
hrefs[marketAlert.request].push(marketAlert.url);
})
console.log("CRAWLER SERVICE: GLOBAL HREFS");
console.log(hrefs);
const olxCrawler = new OlxCrawler(hrefs);
const crawlers = [
olxCrawler,
];
return Promise.map(crawlers, function (crawler) {
return crawler.crawl();
}).then(async (results) => {
try {
const marketAlertsFromDb = await allMarketAlerts(false, true);
console.log("CRAWLER SERVICE: number of existing MarketAlerts from db: " + marketAlertsFromDb.length);
const marketAlerts = [];
const mergedResults = [].concat.apply([], results);
for (const result of mergedResults) {
marketAlerts.push({
url: result.url,
realestateOrigin: "OLX",
originId: 1,
size: result.size,
price: result.price,
email: result.email,
request: result.uuid,
municipality: result.municipality,
region: result.region,
gardenSize: isNaN(result.gardenSize) ? 0 : result.gardenSize,
realEstateType: result.realEstateType,
title: result.title,
notified: false,
hasLocation: result.hasLocation
})
}
console.log("CRAWLER SERVICE: Number of crawler results: " + marketAlerts.length);
try {
const filteredMarketAlerts = marketAlerts.filter((elem) => !marketAlertsFromDb.find(({ url, request }) => {
return (elem.url === url && elem.request === request)
}));
console.log("CRAWLER SERVICE: Number of new crawler results: " + filteredMarketAlerts.length);
await db.MarketAlert.bulkCreate(filteredMarketAlerts);
} catch (e) {
console.log("CRAWLER SERVICE: Could not bulkCreate marketalers reason: ", e);
}
} catch (e) {
console.log("CRAWLER SERVICE: Error crawling. Trying next crawler! ", e);
}
})
} catch (e) {
console.error("CRAWLER SERVICE:could not fetch marketalerts ", e);
}
};
module.exports = crawlAll;

View File

@@ -0,0 +1,29 @@
const db = require("../models/index");
const { allMarketAlerts } = require('../helpers/db/dbHelper');
const { createMarketAlertEmailTemplate, sendBulkEmail } = require('../helpers/awsEmail');
async function processNotifications() {
try {
const marketAlerts = await allMarketAlerts(false, false);
console.log(marketAlerts.length)
await createMarketAlertEmailTemplate();
if (marketAlerts.length > 0) {
console.log("NOTIFICATION SERVICE: Number of new alerts: " + marketAlerts.length)
await sendBulkEmail(marketAlerts);
} else {
console.log("NOTIFICATION SERVICE: No new alerts");
}
await db.MarketAlert.update(
{ notified: true }, /* set attributes' value */
{ where: { notified: false } } /* where criteria */
);
} catch (e) {
console.log("NOTIFICATION SERVICE: could not send notifications reason: ", e);
}
}
module.exports = processNotifications;

2
app/views/gardenSize.ejs Normal file
View File

@@ -0,0 +1,2 @@
<!--suppress HtmlUnknownAnchorTarget -->
<% include partials/range %>

17
app/views/goAgain.ejs Normal file
View File

@@ -0,0 +1,17 @@
<!--suppress HtmlUnknownAnchorTarget -->
<form method="POST" id="form-goagain">
<div class="row centered-element">
<div class="col s3 push-s3">
<a href="/" class="welcome-center-button waves-effect waves-light btn">
Da
</a>
</div>
<div class="col s3 push-s3">
<a href="/" class="welcome-center-button waves-effect waves-light btn">
Ne
</a>
</div>
</div>
</form>

View File

@@ -1,25 +0,0 @@
<div class="row center-align">
<h2>U kojoj regiji tražite nekretninu?</h2>
</div>
<form method="POST" id="form-grad">
<div class="row center-align">
<ul class="collection with-header">
<% for(const grad of gradovi) { %>
<li class="collection-item" > <div id="<%= grad.id %>" ><%= grad.ime %><a href="#!" class="secondary-content"><i class="material-icons">send</i></a></div></li>
<% } %>
</ul>
<input type="hidden" name="grad" id="grad" />
</div>
</form>
<script>
$(document).ready( () => {
$(".collection-item").click( (e) => {
const clickedId = $(e.target).attr("id");
$("#grad").val(clickedId);
$("#form-grad").submit();
});
});
</script>

View File

@@ -1,17 +1,25 @@
<!doctype>
<!doctype>
<html>
<head>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<meta charset="UTF-8" />
<link rel="stylesheet" href="/assets/main.css">
</head>
<body>
<div class="container">
<%-body%>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</body>
</html>
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/13.1.5/nouislider.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<meta charset="UTF-8" />
<link rel="stylesheet" href="/assets/main.css">
</head>
<body>
<% include partials/navBar %>
<div class="container">
<%-body%>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/13.1.5/nouislider.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/wnumb/1.1.0/wNumb.min.js"></script>
</body>
</html>

View File

@@ -1,25 +0,0 @@
<div class="row center-align">
<h2>U kojem mjestu tražite nekretninu?</h2>
</div>
<form method="POST" id="form-mjesto">
<div class="row center-align">
<ul class="collection with-header">
<% for(const mjesto of mjesta) { %>
<li class="collection-item" > <div id="<%= mjesto.id %>" ><%= mjesto.ime %><a href="#!" class="secondary-content"><i class="material-icons">send</i></a></div></li>
<% } %>
</ul>
<input type="hidden" name="mjesto" id="mjesto" />
</div>
</form>
<script>
$(document).ready( () => {
$(".collection-item").click( (e) => {
const clickedId = $(e.target).attr("id");
$("#mjesto").val(clickedId);
$("#form-mjesto").submit();
});
});
</script>

View File

@@ -0,0 +1,24 @@
<!--suppress HtmlUnknownAnchorTarget -->
<form method="POST" id="form-municipality">
<div class="row center-align">
<ul class="collection with-header">
<% for(const municipality of municipalities) { %>
<li class="collection-item">
<div val="<%= municipality.name %>" id="<%= municipality.id %>" onclick="saveAndSubmit(this.id)"><%= municipality.name %>
<a href="#" class="secondary-content">
<i class="material-icons">send</i>
</a>
</div>
</li>
<% } %>
</ul>
<input type="hidden" name="municipality" id="municipality" />
</div>
</form>
<script>
function saveAndSubmit(id, name) {
$("#municipality").val(id);
$("#form-municipality").submit();
}
</script>

View File

@@ -0,0 +1,125 @@
<div class="row center-align">
<div id="floating-panel">
<input id="address" type="textbox" value="">
<input id="submit" type="button" value="Trazi">
</div>
<div id="map"></div>
</div>
<form method="POST" id="form-map-output">
<div class="row center-align">
<div class="col s6 push-s3">
<a id="btnsubmit" href="#" class="welcome-center-button waves-effect waves-light btn">
Dalje
</a>
</div>
</div>
<input type="hidden" name="north" id=north />
<input type="hidden" name="south" id=south />
<input type="hidden" name="east" id=east />
<input type="hidden" name="west" id=west />
</form>
<script>
var map;
var municipality = "<%= municipality%>";
var defaultAddress = document.getElementById('address');
var latLngRestrictions = [];
var BOSNIA_BOUNDS = {
north: 45.70,
south: 41.69,
west: 15.55,
east: 20.77,
};
function initMap() {
var geocoder = new google.maps.Geocoder();
document.getElementById('submit').addEventListener('click', function () {
geocodeAddress(geocoder, map, false, latLngRestrictions);
});
defaultAddress.value = municipality;
geocodeAddress(geocoder, map, true);
$(document).ready(() => {
$("#btnsubmit").click(() => {
var bounds = map.getBounds();
$("#north").val(map.getBounds().getNorthEast().lat());
$("#south").val(map.getBounds().getSouthWest().lat());
$("#east").val(map.getBounds().getNorthEast().lng());
$("#west").val(map.getBounds().getSouthWest().lng());
$("#form-map-output").submit();
});
});
}
function geocodeAddress(geocoder, resultsMap, isInit, geocoderRestrictions) {
var address = document.getElementById('address').value;
let geocoderOptions = geocoderRestrictions
? { 'address': address, 'bounds': geocoderRestrictions }
: { 'address': address }
geocoder.geocode(geocoderOptions, function (results, status) {
if (status === 'OK') {
var bounds = results[0].geometry.bounds;
var resultBounds = new google.maps.LatLngBounds(
results[0].geometry.viewport.getSouthWest(),
results[0].geometry.viewport.getNorthEast()
);
if (isInit) {
map = new google.maps.Map(document.getElementById('map'), {
zoom: 11,
});
resultsMap = map
}
// map.fitBounds(resultBounds);
resultsMap.setCenter(results[0].geometry.location);
if (isInit) {
latLngRestrictions = new google.maps.LatLngBounds(
new google.maps.LatLng(bounds.getSouthWest().lat(), bounds.getSouthWest().lng()),
new google.maps.LatLng(bounds.getNorthEast().lng(), bounds.getNorthEast().lng()));
let latLngRestrictionsa = {
west: bounds.getSouthWest().lng(),
east: bounds.getNorthEast().lng(),
north: bounds.getNorthEast().lat(),
south: bounds.getSouthWest().lat()
}
map.setOptions({
restriction: {
latLngBounds: latLngRestrictionsa,
strictBounds: false,
}
})
} else {
resultsMap.setZoom(17);
}
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAna8ohfV2HBMcxGk_29vqxU5Z_bDickqg&callback=initMap" async
defer></script>
</div>

View File

@@ -0,0 +1,7 @@
<div class="row center-align">
<nav style="background-color: #26a69a; margin: auto;">
<div class="row center-align">
<h6 style="padding-top: 20px;"><%= title %></h5>
</div>
</nav>
</div>

View File

@@ -0,0 +1,53 @@
<form method="POST" id="form-range">
<div class="row center-align no-ui-slider centered-element-small" id="slider"></div>
<div class="col s6 push-s3 centered-element-small">
<a id="btnsubmit" href="#" class="next-center-button waves-effect waves-light btn">
Dalje
</a>
</div>
<input type="hidden" name="from" id="from" />
<input type="hidden" name="to" id="to" />
</form>
<script>
$(document).ready(() => {
var slider = document.getElementById('slider');
const unitFormat = wNumb({
decimals: 3,
thousand: '.',
suffix: '<%= unit %>'
})
noUiSlider.create(slider, {
start: [<%= rangeFrom.value %>, <%= rangeTo.value %>],
connect: true,
tooltips: true,
step: <%= rangeFrom.step %>,
range: {
'min': <%= rangeFrom.min %>,
'max': <%= rangeTo.max %>
},
format: unitFormat
});
$("#btnsubmit").click(() => {
const sliderValues = slider.noUiSlider.get();
$("#from").val(unitFormat.from(sliderValues[0]));
$("#to").val(unitFormat.from(sliderValues[1]));
$("#form-range").submit();
// });
});
});
</script>

2
app/views/price.ejs Normal file
View File

@@ -0,0 +1,2 @@
<!--suppress HtmlUnknownAnchorTarget -->
<% include partials/range %>

32
app/views/queryReview.ejs Normal file
View File

@@ -0,0 +1,32 @@
<!--suppress HtmlUnknownAnchorTarget -->
<form method="POST" id="form-queryreview">
<div class="row center-align">
<ul class="collection with-header">
<% for(const stepData of queryData) { %>
<li class="collection-item" >
<div id="<%= stepData.id %>" ><%= stepData.title || '-' %>
<a href="<%= stepData.url %>" class="secondary-content">
<i class="material-icons">edit</i>
</a>
</div>
</li>
<% } %>
</ul>
</div>
<div class="row">
<div class="col s6 push-s3">
<a id="submit" href="#" class="welcome-center-button waves-effect waves-light btn">
To je to
</a>
</div>
</div>
</form>
<script>
$(document).ready( () => {
$("#submit").click( () => {
$("#form-queryreview").submit();
});
});
</script>

68
app/views/querySubmit.ejs Normal file
View File

@@ -0,0 +1,68 @@
<!--suppress HtmlUnknownAnchorTarget -->
<div class="row center-align">
<h6>Da Vam javimo kada se Vaša željena nekretnina pojavi u oglasima, upišite vaš e-mail</h6>
</div>
<form method="POST" id="form-submitquery">
<div class="row center-align">
<div class="col s6 push-s3">
<input id="email" name="email" type="email" placeholder="vas.email@mail.com" required size="250" />
</div>
</div>
<div class="row">
<div class="col s6 push-s3">
<h6 id="error-lable-email" style="color: red"><%= error %> </h6>
</div>
</div>
<div class="row center-align">
<div class="col s6 push-s3">
<input id="confirm" name="confirm" type="email" placeholder="potvrdite.email@mail.com" required size="250" />
</div>
</div>
<div class="row">
<div class="col s6 push-s3">
<h6 id="error-lable-email-confirm" style="color: red"></h6>
</div>
</div>
<div class="row">
<div class="col s6 push-s3">
<a id="submit" href="#" class="welcome-center-button waves-effect waves-light btn">
Javi mi
</a>
</div>
</div>
<div class="row">
<div class="col s6 push-s3">
<p>* U svakom trenutku možete prekinuti slanje objava kroz link u e-mailu</p>
</div>
</div>
</form>
<script>
$(document).ready(() => {
$("#submit").click(() => {
const emailField = document.getElementById('email');
const emailConfirmField = document.getElementById('confirm');
const errorMessage = "Greška ! Unedite validan email";
$("#error-lable-email").text("");
$("#error-lable-email-confirm").text("");
if (!emailField.validity.valid) {
$("#error-lable-email").text(errorMessage);
return
}
if (!emailConfirmField.validity.valid) {
$("#error-lable-email-confirm").text(errorMessage);
return
}
$("#form-submitquery").submit();
});
});
</script>

View File

@@ -0,0 +1,29 @@
<!--suppress HtmlUnknownAnchorTarget -->
<form method="POST" id="form-real-estate-type">
<div class="row center-align">
<ul class="collection with-header">
<% for(const realEstateType of realEstateTypes) { %>
<li class="collection-item">
<div id="<%= realEstateType.id %>" onclick="saveAndSubmit(this.id)"><%= realEstateType.title %>
<a href="#" class="secondary-content">
<i class="material-icons">send</i>
</a>
</div>
</li>
<% } %>
</ul>
<input type="hidden" name="realestatetype" id="realestatetype" />
</div>
</form>
<script>
function saveAndSubmit(id) {
$("#realestatetype").val(id);
$("#form-real-estate-type").submit();
}
</script>

14
app/views/realEstates.ejs Normal file
View File

@@ -0,0 +1,14 @@
<!--suppress HtmlUnknownAnchorTarget -->
<div class="row center-align">
<ul class="collection with-header">
<% for(const realEstate of realEstates) { %>
<li class="collection-item">
<div><%= realEstate.title %>
<a href="<%= realEstate.url %>" class="secondary-content">
<i class="material-icons">send</i>
</a>
</div>
</li>
<% } %>
</ul>
</div>

25
app/views/region.ejs Normal file
View File

@@ -0,0 +1,25 @@
<!--suppress HtmlUnknownAnchorTarget -->
<form method="POST" id="form-region">
<div class="row center-align">
<ul class="collection with-header">
<% for(const region of regions) { %>
<li class="collection-item">
<div id="<%= region.id %>" onclick="saveAndSubmit(this.id)"><%= region.name %>
<a href="#" class="secondary-content">
<i class="material-icons">send</i>
</a>
</div>
</li>
<% } %>
</ul>
<input type="hidden" name="region" id="region" />
</div>
</form>
<script>
function saveAndSubmit(id) {
$("#region").val(id);
$("#form-region").submit();
}
</script>

2
app/views/size.ejs Normal file
View File

@@ -0,0 +1,2 @@
<!--suppress HtmlUnknownAnchorTarget -->
<% include partials/range %>

11
app/views/unsubscribe.ejs Normal file
View File

@@ -0,0 +1,11 @@
<div class="row center-align">
<span class="welcome-big-logo">🤙</span>
</div>
<div class="row">
<div class="col s6 push-s3">
<a href="<%= nextStep %>" class="welcome-center-button waves-effect waves-light btn">
Nova pretraga
</a>
</div>
</div>

View File

@@ -1,29 +0,0 @@
<div class="row center-align">
<h2>Koju nekretninu tražite?</h2>
</div>
<form method="POST" id="form-vrsta">
<div class="row center-align">
<ul class="collection with-header">
<% for(let vrsta of vrste) { %>
<li class="collection-item" > <div id="<%= vrsta.id %>" ><%= vrsta.ime %><a href="#!" class="secondary-content"><i class="material-icons">send</i></a></div></li>
<% } %>
</ul>
<input type="hidden" name="vrsta" id="vrsta" />
</div>
</form>
<script>
$(document).ready( () => {
$(".collection-item").click( (e) => {
const clickedId = $(e.target).attr("id");
$("#vrsta").val(clickedId);
$("#form-vrsta").submit();
});
});
</script>

View File

@@ -1,7 +1,7 @@
<!-- -->
<div class="row center-align">
<span class="dobrodosli-big-logo">🤙</span>
<span class="welcome-big-logo">🤙</span>
</div>
<div class="row center-align">
<div>Sve nekretnine dostupne u oglasima.</div>
@@ -10,7 +10,7 @@
</div>
<div class="row">
<div class="col s6 push-s3">
<a href="<%= nextStep %>" class="dobrodosli-center-button waves-effect waves-light btn">
<a href="<%= nextStep %>" class="welcome-center-button waves-effect waves-light btn">
Javi mi
</a>
</div>

6
development.env Normal file
View File

@@ -0,0 +1,6 @@
AMAZON_ACCES_KEY_ID=(your-key-here)
AMAZON_SECRET_ACCESS_KEY=(your-key-here)
AMAZON_REGION=eu-west-1
AMAZON_NOTIFICATION_EMAIL_TEMPLATE=MarketAlertTemplateDevelopment
APP_URL=http://localhost:3001
SOURCE_EMAIL=info@saburly.com

104
index.js
View File

@@ -1,14 +1,26 @@
const dobrodosli = require('./app/controllers/dobrodosli').getDobrodosli;
const { getVrstaNekretnine, postVrstaNekretnine} = require('./app/controllers/vrsta_nekretnine');
const { getGrad, postGrad } = require('./app/controllers/grad');
const { getMjesto, postMjesto } = require('./app/controllers/mjesto');
const welcome = require('./app/controllers/welcome').getWelcome;
const { getRealEstateTypes, postRealEstateTypes } = require('./app/controllers/realEstateTypes');
const { getRegion, postRegion } = require('./app/controllers/regions');
const { getMunicipality, postMunicipality } = require('./app/controllers/municipalities');
const { getSize, postSize } = require('./app/controllers/sizes');
const { getGardenSize, postGardenSize } = require('./app/controllers/gardenSizes');
const { getPrice, postPrice } = require('./app/controllers/prices');
const { getQueryReview, postQueryReview } = require('./app/controllers/queryReview');
const { getQuerySubmit, postQuerySubmit } = require('./app/controllers/querySubmit');
const { getGoAgain } = require('./app/controllers/goAgain');
const { getNeighborhood, postNeighborhood } = require('./app/controllers/neighborhoodMap');
const { getUnsubscribe } = require('./app/controllers/unsubscribe');
const { getRealEstates} = require('./app/controllers/realEstates');
const schedule = require('node-schedule');
const crawlAll = require('./app/services/crawlerService')
const processNotifications = require('./app/services/notificationService')
let express = require("express");
const path = require("path");
const bodyParser = require("body-parser");
const MarketAlert = require("./app/models/marketalert");
const sendNotification = require("./app/lib/sendnotification");
const scrapTheItems = require("./app/lib/scraptheitems");
const sendNotification = require("./app/lib/sendNotification");
const scrapTheItems = require("./app/lib/scrapTheItems");
const sequelize = require("./app/models/index").sequelize;
const Twocheckout = require("2checkout-node");
const layout = require('express-layout');
@@ -26,7 +38,7 @@ app.use(layout());
const compression = require('compression');
app.use(compression());
app.get("/api/sendnotifications", async function(req, res) {
app.get("/api/sendnotifications", async (req, res) => {
let marketAlerts = await MarketAlert.findAll();
let lastDateUpdate = await Promise.all(
@@ -59,7 +71,7 @@ app.get("/api/items/:url", async (req, res) => {
});
});
app.post("/api/marketalerts", function(req, res) {
app.post("/api/marketalerts", (req, res) => {
const { email, last_date, olx_url } = req.body;
console.log(email, last_date, olx_url);
sequelize.sync().then(() => {
@@ -75,7 +87,7 @@ app.post("/api/marketalerts", function(req, res) {
});
});
app.post("/api/payforalert", function(request, response) {
app.post("/api/payforalert", (req, res) => {
let tco = new Twocheckout({
sellerId: "901402692",
privateKey: "A28DCE5F-9292-405C-8161-F84D8BB83AFC",
@@ -84,7 +96,7 @@ app.post("/api/payforalert", function(request, response) {
let params = {
merchantOrderId: "123",
token: request.body.token,
token: req.body.token,
currency: "USD",
total: "2.00",
billingAddr: {
@@ -94,34 +106,78 @@ app.post("/api/payforalert", function(request, response) {
state: "BiH",
zipCode: "71000",
country: "BiH",
email: request.body.email,
email: req.body.email,
phoneNumber: "5555555555"
}
};
tco.checkout.authorize(params, function(error, data) {
tco.checkout.authorize(params, function (error, data) {
if (error) {
response.send(error.message);
res.send(error.message);
} else {
response.send(data.response.responseMsg);
res.send(data.response.responseMsg);
}
});
});
app.get('/', dobrodosli);
app.get('/vrstanekretnine/:request_id', getVrstaNekretnine);
app.get('/vrstanekretnine', getVrstaNekretnine);
app.get('/', welcome);
app.get('/vrstanekretnine/:request_id', getRealEstateTypes);
app.get('/vrstanekretnine', getRealEstateTypes);
app.post('/vrstanekretnine/:request_id', postVrstaNekretnine);
app.post('/vrstanekretnine', postVrstaNekretnine);
app.post('/vrstanekretnine/:request_id', postRealEstateTypes);
app.post('/vrstanekretnine', postRealEstateTypes);
app.get('/grad/:request_id', getGrad);
app.post('/grad/:request_id', postGrad);
app.get('/grad/:request_id', getRegion);
app.post('/grad/:request_id', postRegion);
app.get('/mjesto/:request_id', getMjesto);
app.post('/mjesto/:request_id', postMjesto);
app.get('/mjesto/:request_id', getMunicipality);
app.post('/mjesto/:request_id', postMunicipality);
app.get('/naselje/:request_id/:municipality', getNeighborhood);
app.post('/naselje/:request_id/:municipality', postNeighborhood);
app.use('/assets', express.static('./app/public'))
app.get('/povrsina/:request_id', getSize);
app.post('/povrsina/:request_id', postSize);
app.get('/okucnica/:request_id', getGardenSize);
app.post('/okucnica/:request_id', postGardenSize);
app.get('/cijena/:request_id', getPrice);
app.post('/cijena/:request_id', postPrice);
app.get('/pregled/:request_id', getQueryReview);
app.post('/pregled/:request_id', postQueryReview);
app.get('/posalji/:request_id', getQuerySubmit);
app.post('/posalji/:request_id', postQuerySubmit);
app.get('/odjava/:request_id', getUnsubscribe);
app.get('/ponovo', getGoAgain);
app.get('/nekretnine/:request_id', getRealEstates);
app.use('/assets', express.static('./app/public'));
app.listen(port, () => console.log(`Example app listening on port ${port}!`));
var rule = new schedule.RecurrenceRule();
rule.seccond = 1;
schedule.scheduleJob(rule, async function () {
console.log(new Date(), 'Crawler service started');
await crawlAll();
console.log(new Date(), 'Crawler service finished, starting Notification service');
await processNotifications();
console.log(new Date(), 'Notification service finished');
});
/**
* Add flat method to Array
*/
Object.defineProperty(Array.prototype, 'flat', {
value: function(depth = 1) {
return this.reduce(function (flat, toFlatten) {
return flat.concat((Array.isArray(toFlatten) && (depth>1)) ? toFlatten.flat(depth-1) : toFlatten);
}, []);
}
});

2712
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,12 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node ./index.js"
"start": "node ./index.js",
"start-mon": "nodemon ./index.js",
"migrate": "cd app && npx sequelize db:migrate",
"setup": "docker build -t marketalerts . && docker run -e POSTGRES_USER=docker -e POSTGRES_PASSWORD=docker -e POSTGRES_DB=marketalerts --name pg_marketalerts -d -p 5432:5432 marketalerts && sleep 4 && npm run migrate",
"docker-start": "docker start pg_marketalerts",
"docker-stop": "docker stop pg_marketalerts"
},
"repository": {
"type": "git",
@@ -20,16 +25,22 @@
"2checkout-node": "0.0.1",
"@sendgrid/mail": "^6.3.1",
"aws-sdk": "^2.422.0",
"bluebird": "^3.5.5",
"cheerio": "^1.0.0-rc.2",
"compression": "^1.7.4",
"dotenv": "^7.0.0",
"ejs": "^2.6.1",
"express": "^4.16.4",
"express-ejs-layouts": "^2.5.0",
"express-layout": "^0.1.0",
"mysql2": "^1.6.4",
"node-fetch": "^2.3.0",
"node-schedule": "^1.3.2",
"pg": "^7.10.0",
"react-step-wizard": "^5.1.0",
"sequelize": "^4.42.0",
"sequelize-cli": "^5.4.0"
"sequelize": "^4.43.2",
"sequelize-cli": "^5.5.0"
},
"devDependencies": {
"nodemon": "^1.19.0"
}
}