Compare commits
15 Commits
migrate-to
...
email_to_a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f53d60ab0f | ||
|
|
6821054494 | ||
|
|
cb34890583 | ||
|
|
2669aaa9eb | ||
|
|
13a9886292 | ||
|
|
a6df827cd1 | ||
|
|
b67b15c4b9 | ||
|
|
a4ed76e29b | ||
|
|
7fc24add1f | ||
|
|
b1a08a7a57 | ||
|
|
1f7063f94e | ||
|
|
8a1e406f43 | ||
|
|
01b864d75b | ||
|
|
b7cb61b53b | ||
|
|
a957293029 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules/
|
||||
@@ -1,8 +1,4 @@
|
||||
const Sequelize = require("sequelize");
|
||||
const sequelize = new Sequelize("sql7276322", "sql7276322", "RS53ihYlg9", {
|
||||
host: "sql7.freemysqlhosting.net",
|
||||
dialect: "mysql",
|
||||
operatorsAliases: false
|
||||
});
|
||||
const sequelize = new Sequelize(process.env.JAWSDB_URL);
|
||||
|
||||
module.exports = sequelize;
|
||||
|
||||
1168
backend/package-lock.json
generated
1168
backend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"name": "backend",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Ehvan Gradanin",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"2checkout-node": "0.0.1",
|
||||
"@sendgrid/mail": "^6.3.1",
|
||||
"cheerio": "^1.0.0-rc.2",
|
||||
"express": "^4.16.4",
|
||||
"mysql2": "^1.6.4",
|
||||
"node-fetch": "^2.3.0",
|
||||
"sequelize": "^4.42.0"
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
const scrapTheItems = require("./scraptheitems");
|
||||
const convertToDate = require("./convertToDate");
|
||||
const sgMail = require("@sendgrid/mail");
|
||||
// should be process.env.SENDGRID_API_KEY
|
||||
sgMail.setApiKey(
|
||||
"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"
|
||||
);
|
||||
const AWS = require('aws-sdk');
|
||||
AWS.config.update({region: 'eu-central-1'});
|
||||
|
||||
|
||||
async function sendNotification(marketAlert) {
|
||||
const { id, email, olx_url, last_date } = marketAlert;
|
||||
@@ -18,16 +16,43 @@ async function sendNotification(marketAlert) {
|
||||
(mes, item) => mes + `<strong>${item.url} i ${item.price}</strong>`,
|
||||
""
|
||||
);
|
||||
const msg = {
|
||||
to: email,
|
||||
from: "test@example.com",
|
||||
subject: "Market Alert",
|
||||
text: "New items on olx",
|
||||
html: message
|
||||
|
||||
// Create sendEmail params
|
||||
var params = {
|
||||
Destination: { /* required */
|
||||
CcAddresses: [
|
||||
],
|
||||
ToAddresses: [
|
||||
email
|
||||
]
|
||||
},
|
||||
Message: { /* required */
|
||||
Body: { /* required */
|
||||
Html: {
|
||||
Charset: "UTF-8",
|
||||
Data: message
|
||||
},
|
||||
Text: {
|
||||
Charset: "UTF-8",
|
||||
Data: message // TODO: convert to text
|
||||
}
|
||||
},
|
||||
Subject: {
|
||||
Charset: 'UTF-8',
|
||||
Data: 'Javimi alert'
|
||||
}
|
||||
},
|
||||
Source: 'info@saburly.com', /* required */
|
||||
ReplyToAddresses: [
|
||||
'info@saburly.com',
|
||||
],
|
||||
};
|
||||
|
||||
if (message) {
|
||||
await sgMail.send(msg);
|
||||
const sendPromise = new AWS.SES({apiVersion: '2010-12-01'}).sendEmail(params).promise();
|
||||
await sendPromise;
|
||||
return { id, date: String(convertToDate(lastDate)) };
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = sendNotification;
|
||||
|
||||
@@ -20,6 +20,10 @@ const appStyle = theme => ({
|
||||
zIndex: "1",
|
||||
backgroundColor: "#272727",
|
||||
backgroundImage: "linear-gradient(180deg,#272727, #21525f)"
|
||||
},
|
||||
itemsCountTitle: {
|
||||
textAlign: 'center',
|
||||
color: 'white'
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -2,19 +2,19 @@ import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import withStyles from "@material-ui/core/styles/withStyles";
|
||||
import { connect } from "react-redux";
|
||||
import { ITEMS_CHANGED, USER_DATA_CHANGED } from "constants/actionTypes";
|
||||
import { areObjectEqual } from "utils/helpers";
|
||||
import { createOlxLink } from "utils/createOlxLink";
|
||||
import { ITEMS_CHANGED, USER_DATA_CHANGED } from "../constants/actionTypes";
|
||||
import { areObjectEqual } from "../utils/helpers";
|
||||
import { createOlxLink } from "../utils/createOlxLink";
|
||||
import axios from "axios";
|
||||
|
||||
import image from "assets/img/sidebar-1.jpg";
|
||||
import logo from "assets/img/reactlogo.png";
|
||||
import image from "../assets/img/sidebar-1.jpg";
|
||||
import logo from "../assets/img/reactlogo.png";
|
||||
|
||||
import Sidebar from "components/Sidebar.js";
|
||||
import Sidebar from "../components/Sidebar.js";
|
||||
import ItemsContainer from "./items/itemscontainer/ItemsContainer";
|
||||
import NotificationModal from "./NotificationModal";
|
||||
|
||||
import dashboardStyle from "assets/dashboardStyle.js";
|
||||
import dashboardStyle from "../assets/dashboardStyle.js";
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
@@ -84,9 +84,8 @@ class App extends React.Component {
|
||||
return (
|
||||
<div className={classes.wrapper}>
|
||||
<Sidebar logoText={"Market Alarm"} logo={logo} image={image} />
|
||||
|
||||
<div className={classes.mainPanel}>
|
||||
<ItemsContainer />
|
||||
{items.length && <h3 className={classes.itemsCountTitle}>Pronađeno {items.length} nekretnina. Napravite notifikaciju i primite vise detalja na vas emailu adresu.</h3>}
|
||||
{items.length ? <NotificationModal /> : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,8 +5,8 @@ import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import Slide from "@material-ui/core/Slide";
|
||||
import withStyles from "@material-ui/core/styles/withStyles";
|
||||
import { notificationmodalwrapper } from "utils/notificationmodalwrapper";
|
||||
import modalStyle from "assets/modalStyle.js";
|
||||
import { notificationmodalwrapper } from "../utils/notificationmodalwrapper";
|
||||
import modalStyle from "../assets/modalStyle.js";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import Close from "@material-ui/icons/Close";
|
||||
@@ -62,7 +62,7 @@ class NotificationModal extends React.Component {
|
||||
};
|
||||
|
||||
successCallback = data => {
|
||||
token = data.response.token.token;
|
||||
//token = data.response.token.token;
|
||||
const {
|
||||
userdata: { email, last_date, olx_url }
|
||||
} = this.props;
|
||||
@@ -73,18 +73,10 @@ class NotificationModal extends React.Component {
|
||||
last_date,
|
||||
olx_url
|
||||
})
|
||||
.then(response =>
|
||||
axios
|
||||
.post("/payforalert", {
|
||||
email,
|
||||
token
|
||||
})
|
||||
.then(response => {
|
||||
this.handleClose();
|
||||
alert("Market Alert Created");
|
||||
})
|
||||
.catch(error => console.log(error))
|
||||
)
|
||||
.then(response => {
|
||||
this.handleClose();
|
||||
alert("Market Alert Created");
|
||||
})
|
||||
.catch(error => console.log(error));
|
||||
};
|
||||
|
||||
@@ -114,7 +106,8 @@ class NotificationModal extends React.Component {
|
||||
};
|
||||
|
||||
handleSaveMarketAlert = () => {
|
||||
this.tokenRequest();
|
||||
this.successCallback();
|
||||
//this.tokenRequest();
|
||||
};
|
||||
|
||||
render() {
|
||||
@@ -161,82 +154,22 @@ class NotificationModal extends React.Component {
|
||||
id="classic-modal-slide-description"
|
||||
className={classes.modalBody}
|
||||
>
|
||||
<FormControlLabel
|
||||
className={classes.whiteText}
|
||||
control={
|
||||
<Checkbox
|
||||
className={classes.checkBoxStyle}
|
||||
checked={this.isChecked("emailChecked")}
|
||||
type={"checkbox"}
|
||||
value={""}
|
||||
onChange={() => this.optionChange("emailChecked")}
|
||||
/>
|
||||
}
|
||||
label={<Typography style={{ color: "white" }}>Email</Typography>}
|
||||
/>
|
||||
|
||||
{this.isChecked("emailChecked") ? (
|
||||
<div>
|
||||
<Input
|
||||
className={classes.inputStyle}
|
||||
placeholder="Email"
|
||||
inputProps={{
|
||||
"aria-label": "Email"
|
||||
}}
|
||||
type="email"
|
||||
onChange={this.handleEmail}
|
||||
/>
|
||||
<Input
|
||||
className={classes.inputStyle}
|
||||
type="hidden"
|
||||
value={token}
|
||||
/>
|
||||
<Input
|
||||
className={classes.inputStyle}
|
||||
placeholder="Card Number"
|
||||
inputProps={{
|
||||
"aria-label": "Card Number"
|
||||
}}
|
||||
required
|
||||
autoComplete="off"
|
||||
type="number"
|
||||
onChange={e => this.handleInput(e, "ccNo")}
|
||||
/>
|
||||
<Input
|
||||
className={classes.inputStyle}
|
||||
placeholder="Expiration Year"
|
||||
inputProps={{
|
||||
"aria-label": "Expiration Year"
|
||||
}}
|
||||
required
|
||||
autoComplete="off"
|
||||
type="number"
|
||||
onChange={e => this.handleInput(e, "expYear")}
|
||||
/>
|
||||
<Input
|
||||
className={classes.inputStyle}
|
||||
placeholder="Expiration Month"
|
||||
inputProps={{
|
||||
"aria-label": "Expiration Month"
|
||||
}}
|
||||
required
|
||||
autoComplete="off"
|
||||
type="number"
|
||||
onChange={e => this.handleInput(e, "expMonth")}
|
||||
/>
|
||||
<Input
|
||||
className={classes.inputStyle}
|
||||
placeholder="CVV"
|
||||
inputProps={{
|
||||
"aria-label": "CVV"
|
||||
}}
|
||||
required
|
||||
autoComplete="off"
|
||||
type="number"
|
||||
onChange={e => this.handleInput(e, "cvv")}
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
<div>
|
||||
<Input
|
||||
className={classes.inputStyle}
|
||||
placeholder="Email"
|
||||
inputProps={{
|
||||
"aria-label": "Email"
|
||||
}}
|
||||
type="email"
|
||||
onChange={this.handleEmail}
|
||||
/>
|
||||
<Input
|
||||
className={classes.inputStyle}
|
||||
type="hidden"
|
||||
value={token}
|
||||
/>
|
||||
</div>
|
||||
</DialogContent>
|
||||
<DialogActions className={classes.modalFooter}>
|
||||
{validEmail ? (
|
||||
|
||||
@@ -12,16 +12,15 @@ import ExpandMore from "@material-ui/icons/ExpandMore";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import StarBorder from "@material-ui/icons/StarBorder";
|
||||
|
||||
import sidebarStyle from "assets/sidebarStyle.js";
|
||||
import CollapseWrapperStyled from "components/widgets/CollapseWrapperStyled";
|
||||
import sidebarStyle from "../assets/sidebarStyle.js";
|
||||
import CollapseWrapperStyled from "../components/widgets/CollapseWrapperStyled";
|
||||
import DeepCategoryWrapper from "./widgets/DeepCategoryWrapper";
|
||||
import { hoc } from "utils/helpers";
|
||||
import { hoc } from "../utils/helpers";
|
||||
|
||||
import * as Vozila from "./categories/Vozila";
|
||||
import * as Nekretnine from "./categories/Nekretnine";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { CATEGORY_SELECT } from "constants/actionTypes";
|
||||
import { CATEGORY_SELECT } from "../constants/actionTypes";
|
||||
|
||||
const options = [
|
||||
{ value: "Nekretnine", label: "Nekretnine" }
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
import React from "react";
|
||||
|
||||
import Automobili from "../subcategories/vozila/Automobili";
|
||||
import Motocikli from "../subcategories/vozila/Motocikli";
|
||||
|
||||
const options = [
|
||||
{ value: 18, label: "Automobili" },
|
||||
{ value: 21, label: "Motocikli" }
|
||||
];
|
||||
const depth = 0;
|
||||
const childrenComponents = {
|
||||
18: <Automobili />,
|
||||
21: <Motocikli />
|
||||
};
|
||||
|
||||
export const properties = {
|
||||
options,
|
||||
depth,
|
||||
childrenComponents
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from "react";
|
||||
import * as Filters from "./AllFiltersDefined";
|
||||
import CheckboxAndRadioWrapper from "components/widgets/CheckboxAndRadioWrapper";
|
||||
import SelectDisplayCheckboxWrapper from "components/widgets/SelectDisplayCheckboxWrapper";
|
||||
import RangeWrapper from "components/widgets/RangeWrapper";
|
||||
import DropDownWrapper from "components/widgets/DropDownWrapper";
|
||||
import CheckboxAndRadioWrapper from "../../widgets/CheckboxAndRadioWrapper";
|
||||
import SelectDisplayCheckboxWrapper from "../../widgets/SelectDisplayCheckboxWrapper";
|
||||
import RangeWrapper from "../../widgets/RangeWrapper";
|
||||
import DropDownWrapper from "../../widgets/DropDownWrapper";
|
||||
|
||||
const Kanton = (
|
||||
<DropDownWrapper componentName="Lokacija" {...Filters.lokacijaOptions} />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WrapAll } from "components/widgets/CollapseWrapperAll";
|
||||
import { WrapAll } from "../../widgets/CollapseWrapperAll";
|
||||
import {
|
||||
Kanton,
|
||||
Grad,
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
Vrsta,
|
||||
Kvadratura,
|
||||
DodatnoZaKucu
|
||||
} from "components/filters/NekretnineFilter/index";
|
||||
} from "../../filters/NekretnineFilter/index";
|
||||
|
||||
const KuceFilters = [
|
||||
Kanton,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { WrapAll } from "components/widgets/CollapseWrapperAll";
|
||||
import { WrapAll } from "../../widgets/CollapseWrapperAll";
|
||||
import {
|
||||
Kanton,
|
||||
Grad,
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
Vrsta,
|
||||
Kvadratura,
|
||||
DodatnoZaStan
|
||||
} from "components/filters/NekretnineFilter/index";
|
||||
} from "../../filters/NekretnineFilter/index";
|
||||
|
||||
const StanFilters = [
|
||||
Kanton,
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import { WrapAll } from "components/widgets/CollapseWrapperAll";
|
||||
import {
|
||||
Proizvodac,
|
||||
Kanton,
|
||||
Grad,
|
||||
Cijena,
|
||||
Stanje,
|
||||
Vrsta,
|
||||
Godiste,
|
||||
KilometraMin,
|
||||
KilometraMax,
|
||||
Gorivo
|
||||
} from "components/filters/VozilaFilter/index";
|
||||
|
||||
const AutomobiliFilters = [
|
||||
Proizvodac,
|
||||
Kanton,
|
||||
Grad,
|
||||
Cijena,
|
||||
Stanje,
|
||||
Vrsta,
|
||||
Godiste,
|
||||
KilometraMin,
|
||||
KilometraMax,
|
||||
Gorivo
|
||||
];
|
||||
const Automobili = () => WrapAll(AutomobiliFilters);
|
||||
|
||||
export default Automobili;
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from "react";
|
||||
import { optionchangewrapper } from "utils/optionchangewrapper";
|
||||
import { optionchangewrapper } from "../../utils/optionchangewrapper";
|
||||
import Checkbox from "@material-ui/core/Checkbox";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import "assets/checkboxAndRadioStyle.css";
|
||||
import "../../assets/checkboxAndRadioStyle.css";
|
||||
|
||||
class CheckboxAndRadioWrapper extends React.Component {
|
||||
optionChange = (option, optionName, type) => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { OPTION_EXPAND_CHANGE } from "constants/actionTypes";
|
||||
import { OPTION_EXPAND_CHANGE } from "../../constants/actionTypes";
|
||||
|
||||
import withStyles from "@material-ui/core/styles/withStyles";
|
||||
import sidebarStyle from "assets/sidebarStyle.js";
|
||||
import sidebarStyle from "../../assets/sidebarStyle.js";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import ListItem from "@material-ui/core/ListItem";
|
||||
import ListItemIcon from "@material-ui/core/ListItemIcon";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from "react";
|
||||
import { subcategorywrapper } from "utils/subcategorywrapper";
|
||||
import { hoc } from "utils/helpers";
|
||||
import { subcategorywrapper } from "../../utils/subcategorywrapper";
|
||||
import { hoc } from "../../utils/helpers";
|
||||
|
||||
import withStyles from "@material-ui/core/styles/withStyles";
|
||||
import sidebarStyle from "assets/sidebarStyle.js";
|
||||
import sidebarStyle from "../../assets/sidebarStyle.js";
|
||||
import List from "@material-ui/core/List";
|
||||
import ListItem from "@material-ui/core/ListItem";
|
||||
import ListItemIcon from "@material-ui/core/ListItemIcon";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import React from "react";
|
||||
import { optionchangewrapper } from "utils/optionchangewrapper";
|
||||
import { optionchangewrapper } from "../../utils/optionchangewrapper";
|
||||
|
||||
import withStyles from "@material-ui/core/styles/withStyles";
|
||||
import List from "@material-ui/core/List";
|
||||
import ListItem from "@material-ui/core/ListItem";
|
||||
import ListItemIcon from "@material-ui/core/ListItemIcon";
|
||||
import ListItemText from "@material-ui/core/ListItemText";
|
||||
import sidebarStyle from "assets/sidebarStyle.js";
|
||||
import sidebarStyle from "../../assets/sidebarStyle.js";
|
||||
import StarBorder from "@material-ui/icons/StarBorder";
|
||||
|
||||
class DropdownWrapper extends React.Component {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from "react";
|
||||
import { Range } from "rc-slider";
|
||||
import { optionchangewrapper } from "utils/optionchangewrapper";
|
||||
import "assets/rangeStyle.css";
|
||||
import { optionchangewrapper } from "../../utils/optionchangewrapper";
|
||||
import "../../assets/rangeStyle.css";
|
||||
import "rc-slider/assets/index.css";
|
||||
import Input from "@material-ui/core/Input";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import CheckboxAndRadioWrapper from "components/widgets/CheckboxAndRadioWrapper";
|
||||
import { optionchangewrapper } from "utils/optionchangewrapper";
|
||||
import CheckboxAndRadioWrapper from "../../components/widgets/CheckboxAndRadioWrapper";
|
||||
import { optionchangewrapper } from "../../utils/optionchangewrapper";
|
||||
|
||||
class SelectDisplayCheckboxWrapper extends React.Component {
|
||||
render() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CATEGORY_SELECT } from "constants/actionTypes";
|
||||
import { CATEGORY_SELECT } from "../constants/actionTypes";
|
||||
|
||||
export default (state = null, action) => {
|
||||
switch (action.type) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
SUBCATEGORY_SELECT,
|
||||
CATEGORY_SELECT,
|
||||
OPTION_CHANGE
|
||||
} from "constants/actionTypes";
|
||||
} from "../constants/actionTypes";
|
||||
|
||||
export default (state = [], action) => {
|
||||
switch (action.type) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MODAL_CLOSE, MODAL_OPEN } from "constants/actionTypes";
|
||||
import { MODAL_CLOSE, MODAL_OPEN } from "../constants/actionTypes";
|
||||
|
||||
export default (state = false, action) => {
|
||||
switch (action.type) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
SUBCATEGORY_SELECT,
|
||||
CATEGORY_SELECT,
|
||||
OPTION_CHANGE
|
||||
} from "constants/actionTypes";
|
||||
} from "../constants/actionTypes";
|
||||
|
||||
export default (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SUBCATEGORY_SELECT, CATEGORY_SELECT } from "constants/actionTypes";
|
||||
import { SUBCATEGORY_SELECT, CATEGORY_SELECT } from "../constants/actionTypes";
|
||||
|
||||
export default (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
OPTION_EXPAND_CHANGE,
|
||||
CATEGORY_SELECT,
|
||||
SUBCATEGORY_SELECT
|
||||
} from "constants/actionTypes";
|
||||
} from "../constants/actionTypes";
|
||||
|
||||
export default (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { USER_DATA_CHANGED } from "constants/actionTypes";
|
||||
import { USER_DATA_CHANGED } from "../constants/actionTypes";
|
||||
|
||||
export default (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
MODAL_CLOSE,
|
||||
MODAL_OPEN,
|
||||
USER_DATA_CHANGED
|
||||
} from "constants/actionTypes";
|
||||
} from "../constants/actionTypes";
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { connect } from "react-redux";
|
||||
import { OPTION_CHANGE } from "constants/actionTypes";
|
||||
import { OPTION_CHANGE } from "../constants/actionTypes";
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { connect } from "react-redux";
|
||||
import { SUBCATEGORY_SELECT } from "constants/actionTypes";
|
||||
import { SUBCATEGORY_SELECT } from "../constants/actionTypes";
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
let express = require("express");
|
||||
const path = require("path");
|
||||
const bodyParser = require("body-parser");
|
||||
const MarketAlert = require("./MarketAlert");
|
||||
const sendNotification = require("./utils/sendnotification");
|
||||
const scrapTheItems = require("./utils/scraptheitems");
|
||||
const sequelize = require("./db.js");
|
||||
const MarketAlert = require("./backend/MarketAlert");
|
||||
const sendNotification = require("./backend/utils/sendnotification");
|
||||
const scrapTheItems = require("./backend/utils/scraptheitems");
|
||||
const sequelize = require("./backend/db.js");
|
||||
const Twocheckout = require("2checkout-node");
|
||||
|
||||
const app = express();
|
||||
@@ -49,15 +49,17 @@ app.get("/items/:url", async (req, res) => {
|
||||
app.post("/marketalerts", function(req, res) {
|
||||
const { email, last_date, olx_url } = req.body;
|
||||
console.log(email, last_date, olx_url);
|
||||
res.json({ message: "Market Alert Created!" });
|
||||
// sequelize.sync().then(() =>
|
||||
// MarketAlert.create({
|
||||
// olx_url,
|
||||
// last_date,
|
||||
// email
|
||||
// })
|
||||
// );
|
||||
// res.json({ message: "Market Alert Created!" });
|
||||
sequelize.sync().then(() => {
|
||||
MarketAlert.create({
|
||||
olx_url,
|
||||
last_date,
|
||||
email
|
||||
})
|
||||
.then(() => {
|
||||
res.json({ message: "Market Alert Created!" });
|
||||
})
|
||||
.catch(e => console.error(e));
|
||||
});
|
||||
});
|
||||
|
||||
app.post("/payforalert", function(request, response) {
|
||||
@@ -93,4 +95,11 @@ app.post("/payforalert", function(request, response) {
|
||||
});
|
||||
});
|
||||
|
||||
app.use(express.static(path.join(__dirname, 'frontend-react/build')));
|
||||
|
||||
// Anything that doesn't match the above, send back index.html
|
||||
app.get('*', (req, res) => {
|
||||
res.sendFile(path.join(__dirname + '/frontend-react/build/index.html'))
|
||||
})
|
||||
|
||||
app.listen(port, () => console.log(`Example app listening on port ${port}!`));
|
||||
1244
package-lock.json
generated
1244
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
30
package.json
Normal file
30
package.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "marketalarm",
|
||||
"version": "1.0.1",
|
||||
"description": "Market Alarm",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node ./index.js",
|
||||
"heroku-postbuild": "cd frontend-react && npm install && npm run build"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@gitlab.com:saburly/marketalarm/web.git"
|
||||
},
|
||||
"author": "Saburlije",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "11.10.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"2checkout-node": "0.0.1",
|
||||
"@sendgrid/mail": "^6.3.1",
|
||||
"aws-sdk": "^2.422.0",
|
||||
"cheerio": "^1.0.0-rc.2",
|
||||
"express": "^4.16.4",
|
||||
"mysql2": "^1.6.4",
|
||||
"node-fetch": "^2.3.0",
|
||||
"sequelize": "^4.42.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user