Merged finished kivi-input in view

This commit is contained in:
Naida Vatric
2020-03-14 14:09:36 +01:00
17 changed files with 415 additions and 261 deletions

View File

@@ -6,16 +6,6 @@ const {
} = require("./enums");
const BASIC_BOOLEAN_PUBLISH = [
{
dbField: "balcony",
title: "Balkon",
categoriesToShow: [
AD_CATEGORY.FLAT,
AD_CATEGORY.HOUSE,
AD_CATEGORY.APARTMENT,
AD_CATEGORY.COTTAGE
]
},
{
dbField: "newBuilding",
title: "Novogradnja",
@@ -28,6 +18,17 @@ const BASIC_BOOLEAN_PUBLISH = [
AD_CATEGORY.GARAGE
]
},
{
dbField: "balcony",
title: "Balkon",
categoriesToShow: [
AD_CATEGORY.FLAT,
AD_CATEGORY.HOUSE,
AD_CATEGORY.APARTMENT,
AD_CATEGORY.COTTAGE
]
},
{
dbField: "elevator",
title: "Lift",
@@ -51,6 +52,34 @@ const BASIC_BOOLEAN_PUBLISH = [
];
const BASIC_INPUT_PUBLISH = [
{
dbField: "title",
title: "Naslov",
categoriesToShow: [
AD_CATEGORY.FLAT,
AD_CATEGORY.HOUSE,
AD_CATEGORY.APARTMENT,
AD_CATEGORY.COTTAGE,
AD_CATEGORY.OFFICE,
AD_CATEGORY.LAND,
AD_CATEGORY.GARAGE
],
constraint: ["required"]
},
{
dbField: "shortDescription",
title: "Opis",
categoriesToShow: [
AD_CATEGORY.FLAT,
AD_CATEGORY.HOUSE,
AD_CATEGORY.APARTMENT,
AD_CATEGORY.COTTAGE,
AD_CATEGORY.OFFICE,
AD_CATEGORY.LAND,
AD_CATEGORY.GARAGE
],
constraint: []
},
{
dbField: "price",
title: "Cijena (KM)",
@@ -85,6 +114,20 @@ const BASIC_INPUT_PUBLISH = [
categoriesToShow: [AD_CATEGORY.HOUSE, AD_CATEGORY.COTTAGE],
constraint: ["numerical"]
},
{
dbField: "streetName",
title: "Adresa",
categoriesToShow: [
AD_CATEGORY.FLAT,
AD_CATEGORY.HOUSE,
AD_CATEGORY.APARTMENT,
AD_CATEGORY.COTTAGE,
AD_CATEGORY.OFFICE,
AD_CATEGORY.LAND,
AD_CATEGORY.GARAGE
],
constraint: []
},
{
dbField: "numberOfRooms",
title: "Broj soba",
@@ -117,48 +160,6 @@ const BASIC_INPUT_PUBLISH = [
AD_CATEGORY.OFFICE
],
constraint: ["integer"]
},
{
dbField: "title",
title: "Naslov",
categoriesToShow: [
AD_CATEGORY.FLAT,
AD_CATEGORY.HOUSE,
AD_CATEGORY.APARTMENT,
AD_CATEGORY.COTTAGE,
AD_CATEGORY.OFFICE,
AD_CATEGORY.LAND,
AD_CATEGORY.GARAGE
],
constraint: ["required"]
},
{
dbField: "shortDescription",
title: "Opis",
categoriesToShow: [
AD_CATEGORY.FLAT,
AD_CATEGORY.HOUSE,
AD_CATEGORY.APARTMENT,
AD_CATEGORY.COTTAGE,
AD_CATEGORY.OFFICE,
AD_CATEGORY.LAND,
AD_CATEGORY.GARAGE
],
constraint: []
},
{
dbField: "streetName",
title: "Adresa",
categoriesToShow: [
AD_CATEGORY.FLAT,
AD_CATEGORY.HOUSE,
AD_CATEGORY.APARTMENT,
AD_CATEGORY.COTTAGE,
AD_CATEGORY.OFFICE,
AD_CATEGORY.LAND,
AD_CATEGORY.GARAGE
],
constraint: []
}
];

View File

@@ -1,4 +1,5 @@
const { findRealEstateByAgencyId } = require("../helpers/db/realEstate");
const { bulkUpsertKiviPhotos } = require("../helpers/db/kiviOriginalAdsPhotos");
const { currentKiviRealEstate } = require("../helpers/url");
const validate = require("validate.js");
@@ -188,6 +189,9 @@ const postPublishInputs = async (req, res) => {
const nextStepPage = req.query.nextStep || "/uspjesnaobjava";
//Request body
//console.log("Body:", req.body);
const balcony = req.body.balcony === "on";
const elevator = req.body.elevator === "on";
const newBuilding = req.body.newBuilding === "on";
@@ -248,6 +252,16 @@ const postPublishInputs = async (req, res) => {
const locationLong = req.body.lng || null;
//Contact email saved in other table
const contactEmail = req.body.email || "";
//Image urls are stored in new table
const imageUrls =
req.body.imageUrls.split("|").filter(url => url !== "") || [];
const imageUrlsData = imageUrls.map(url => {
return {
kiviAdId: kiviOriginal.kiviAdId,
photoUrl: url
};
});
const savedImageUrls = await bulkUpsertKiviPhotos(imageUrlsData);
realEstate.balcony = balcony;
realEstate.elevator = elevator;

View File

@@ -0,0 +1,17 @@
"use strict";
const db = require("../../models/index");
const sequelize = require("sequelize");
const bulkUpsertKiviPhotos = async kiviPhotosData => {
try {
return await db.KiviOriginalAdsPhotos.bulkCreate(kiviPhotosData, {
ignoreDuplicates: true
});
} catch (e) {
console.log("Error bulk upserting kiviOriginalAdsPhotos : ", e);
}
};
module.exports = {
bulkUpsertKiviPhotos
};

View File

@@ -0,0 +1,39 @@
"use strict";
module.exports = {
up: (queryInterface, Sequelize) => {
const tableFields = {
id: {
type: Sequelize.BIGINT,
autoIncrement: true,
primaryKey: true,
allowNull: false
},
kiviAdId: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "KiviOriginal",
key: "kiviAdId"
}
},
photoUrl: {
type: Sequelize.TEXT,
allowNull: false
},
createdAt: {
type: Sequelize.DATE,
defaultValue: Sequelize.literal("NOW()")
},
updatedAt: {
type: Sequelize.DATE,
defaultValue: Sequelize.literal("NOW()")
}
};
return queryInterface.createTable("KiviOriginalAdsPhotos", tableFields);
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable("KiviOriginalAdsPhotos", {});
}
};

View File

@@ -0,0 +1,41 @@
"use strict";
module.exports = (sequalize, DataTypes) => {
const KiviOriginalAdsPhotos = sequalize.define(
"KiviOriginalAdsPhotos",
{
id: {
type: DataTypes.BIGINT,
autoIncrement: true,
primaryKey: true,
allowNull: false
},
kiviAdId: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: "KiviOriginal",
key: "kiviAdId"
}
},
photoUrl: {
type: DataTypes.TEXT,
allowNull: false
}
},
{
freezeTableName: true
}
);
KiviOriginalAdsPhotos.associate = models => {
KiviOriginalAdsPhotos.hasMany(models.KiviOriginal, {
foreignKey: "kiviAdId",
sourceKey: "kiviAdId",
targetKey: "kiviAdId",
as: "kiviOriginal"
});
};
return KiviOriginalAdsPhotos;
};

View File

@@ -164,7 +164,6 @@ h3 {
}
.custom-col {
width: 18%;
margin-left: auto;
left: auto;
right: auto;
@@ -190,3 +189,16 @@ h3 {
opacity: 1;
position: relative;
}
.dropzone {
background: white;
border-radius: 10px;
border: 4px dashed #02adba;
border-image: none;
max-width: 80%;
margin-left: auto;
margin-right: auto;
}
.dz-progress {
display: none;
}

View File

@@ -9,14 +9,21 @@
gtag('js', new Date());
gtag('config', '<%= process.env.GA_ID %>');
</script>
<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">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.7.0/dropzone.css">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/validate.js/0.13.1/validate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.7.0/dropzone.js"></script>
<script type="text/javascript">
Dropzone.autoDiscover = false;
</script>
<meta charset="UTF-8" />
<link rel="stylesheet" href="/assets/main.css">
<link rel="stylesheet" href="/assets/segment.css">
@@ -52,6 +59,9 @@
<% } else { %>
<title>Kivi.ba</title>
<% } %>
</head>
<body>

View File

@@ -1,7 +1,7 @@
<br>
<div class="row">
<% for (const input of additionalInputInputs){ %>
<div class="input-field col s3 m4 l5">
<div class="input-field col s12">
<textarea
id="<%= input.dbField %>"
form="publishForm"
@@ -15,9 +15,10 @@
</div>
<br>
<div class="row">
<% for (const input of additionalBooleanPublishInputs){ %>
<p>
<p class="col s6 m4 l4">
<label class="checkbox-label">
<input type="checkbox" class="filled-in" name="<%= input.dbField %>"
<% if (additionalBooleanPublishValues[input.dbField]) { %>
@@ -27,7 +28,7 @@
</label>
</p>
<% } %>
</div>
<br>
<% for (const input of additionalSegmentSelectInputs){ %>
<div>

View File

@@ -1,7 +1,7 @@
<br>
<div class="row" id="basic-inputs">
<% for (const input of basicInputInputs){ %>
<div class="input-field col s3 m4 l5">
<div class="input-field col s10 m5 l4">
<input
id="<%= input.dbField %>"
name="<%= input.dbField %>"

View File

@@ -1,72 +1,12 @@
<br>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--file">
<input type="file" id="selector">
</div>
<input class="mdl-button mdl-button--raised mdl-button--colored" type="button" value="Upload"
onclick="generateSignedURL()">
<div action="/photos-upload" class="dropzone" id="photos-upload">
<div class="fallback">
<input name="file" type="file" multiple />
</div>
</div>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--file" id="status"></div>
<br>
<script type="text/javascript">
/*
var c = "";
var filename = "";
function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
function getFilename() {
var fullPath = document.getElementById('selector').value;
if (fullPath) {
var startIndex = (fullPath.indexOf('\\') >= 0 ? fullPath.lastIndexOf('\\') : fullPath.lastIndexOf('/'));
filename = fullPath.substring(startIndex);
if (filename.indexOf('\\') === 0 || filename.indexOf('/') === 0) {
filename = filename.substring(1);
}
filename = (uuidv4() + filename).replace(/\s+/g, '');
return (filename);
}
return (null);
}
function upload() {
var file = $('#selector')[0].files[0];
uploadFile(file)
}
async function generateSignedURL() {
const file = getFilename();
const response = await fetch('/generateSignedURL?filename=' + file);
if (!response.ok) {
throw new Error('Network response for fetch was not ok.');
}
c = await response.text();
c = c.replace(/\"/g, "")
console.log("Got signedURL: " + c)
console.log("Trying to upload " + file)
upload();
console.log("Complete")
return false;
}
function uploadFile(file) {
$("#status").html('Starting Upload...')
url = c
fetch(url, {
method: 'PUT',
body: file
})
.then(response => response.text())
.catch(error => $("#status").html(error)
)
.then(response => $("#status").html('File uploaded successfully: ' + filename));
}
*/
</script>
<input type="hidden" name="imageUrls" id="imageUrls" value="">

View File

@@ -3,11 +3,11 @@
<div class="row">
<div class="col s12">
<ul class="tabs">
<li class="tab custom-col"><a href="#publishBasicData">Osnovni podaci</a></li>
<li class="tab custom-col"><a href="#publishAdditionalData">Dodatni podaci</a></li>
<li class="tab custom-col"><a href="#publishLocation">Lokacija</a></li>
<li class="tab custom-col"><a href="#publishPhotos">Fotografije</a></li>
<li class="tab custom-col"><a href="#publishEnd">Kraj</a></li>
<li class="tab col s3"><a href="#publishBasicData">Osnovni podaci</a></li>
<li class="tab col s3"><a href="#publishAdditionalData">Dodatni podaci</a></li>
<li class="tab col s2"><a href="#publishLocation">Lokacija</a></li>
<li class="tab col s2"><a href="#publishPhotos">Fotografije</a></li>
<li class="tab col s2"><a href="#publishEnd">Kraj</a></li>
</ul>
</div>
@@ -32,10 +32,85 @@
</form>
<script>
function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
const r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
function getFileName(fileName) {
const encodedFileName = (uuidv4() + fileName).replace(/\s+/g, '');
return encodedFileName;
}
function upload() {
var file = $('#selector')[0].files[0];
uploadFile(file)
}
async function generateSignedURL(file) {
const fileName = getFileName(file.name);
const response = await fetch('/generateSignedURL?filename=' + fileName);
if (!response.ok) {
throw new Error('Network response for fetch was not ok.');
}
let signedUrl = await response.text();
signedUrl = signedUrl.replace(/\"/g, "")
await uploadFile(file, fileName, signedUrl);
return fileName;
}
function uploadFile(file, fileName, url) {
return fetch(url, {
method: 'PUT',
headers: new Headers({'content-type': 'image/*'}),
mode: 'cors',
body: file
})
.then(response => response.text())
.then (response => {
return response;
}
)
.catch(error => $("#status").html(error)
)
.then(response => {
$("#imageUrls").val($("#imageUrls").val()+ fileName+"|");
});
}
$(document).ready(function(){
$('.tabs').tabs();
// Manual dropzone init
const dropzoneOptions = {
url: "/photos-upload", //can be a function that returns url ?
autoProcessQueue:false, //not to upload files automaticly
method: "put", //or post
parallelUploads: 1,
uploadMultiple: false,
addRemoveLinks: true,
maxFilesize: 2, //MB,
resizeWidth: 600,
maxFiles: 10,
acceptedFiles: "image/*",
dictDefaultMessage: `<span class="text-center">
<h3>Prevuci fotografije ili klikni za dodavanje!</h3>
(Maksimalno 10 fotografija.)
</span>`,
dictResponseError: 'Error uploading file!',
dictRemoveFile: 'Izbriši ',
dictFileTooBig: 'Fajl je prevelik!',
dictInvalidFileType: 'Iabrani fajl nije fotografija!',
dictMaxFilesExceeded: 'Dostigli ste maksimalan broj fotografija!'
};
var photosUploader = new Dropzone('#photos-upload', dropzoneOptions);
//VALIDATION - WiP
//Helper validation functions
const isValidEmail = $email => {
const simpleEmailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
@@ -152,7 +227,8 @@
}
$("#submit").click( function () {
$("#submit").click( async function (e) {
e.preventDefault();
if (marker) {
const currentLocation = marker.getPosition();
@@ -170,7 +246,6 @@
$("#lng").val(0);
}
//Tag for checking of error presence
let hasErrors = false;
//Check if email is valid
@@ -196,12 +271,19 @@
validate (input);
} */
const addedFiles = photosUploader.files.filter(file => file.status!=="error");
const asyncUpload =[];
addedFiles.forEach( file => {
asyncUpload.push(generateSignedURL(file));
})
if (!hasErrors) {
await Promise.all(asyncUpload);
$("#publishForm").submit();
if (!hasErrors) {
$("#publishForm").submit();
};
});
});

View File

@@ -7,6 +7,7 @@ const forceSSL = require("./app/helpers/forceSSL");
const { Storage } = require("@google-cloud/storage");
const validate = require("validate.js");
const cors = require("cors");
const {
APP_PORT,
@@ -22,6 +23,8 @@ const {
const app = express();
app.use(cors());
app.use(forceSSL());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
@@ -55,46 +58,34 @@ setInterval(crawl, CRAWLER_INTERVAL * 1000);
setInterval(checkUpNotify, 1000 * 60 * 60 * 24);
//Google storage req
const PROJECT_ID = "marketalarm";
const KEY_FILENAME = ""; //relative path
const BUCKET_NAME = "marketalarm-photos";
const storage = new Storage();
const BUCKET_NAME = "kivi_original_photos";
const bucket = storage.bucket(BUCKET_NAME);
/*
async function generateSignedUrl() {
const options = {
version: "v2",
action: "write",
expires: Date.now() + 86400000
};
const [url] = bucket.file("aFile").getSignedUrl(options);
console.log(`The signed url for aFile is ${url}.`);
return url;
}*/
//generateSignedUrl().catch(console.error);
app.get("/generateSignedURL", (req, res) => {
console.log("Started server function!");
async function generateSignedUrl() {
// console.log("Started server function!");
const options = {
version: "v2",
action: "write",
expires: Date.now() + 86400000
};
const filename = req.query.filename;
const options = {
//Tried to define Google ID and private key while debugging
version: "v2", //tried v4 also
action: "write",
contentType: "image/*", //tried without and with specific image/png ex.
expires: Date.now() + 86400000
};
const filename = req.query.filename;
console.log("Filename: ", filename);
console.log("Bucket name:", bucket.name);
// console.log("Filename: ", filename);
// console.log("Bucket name:", bucket.name);
const url = bucket.file(filename).getSignedUrl(options, function(err, url) {
if (err) {
console.error(err);
return;
}
return url;
});
const [url] = await bucket.file(filename).getSignedUrl(options);
console.log(`The signed url for ${filename} is ${url}.`);
res.send(url);
//console.log(`The signed url is ${url}.`);
res.status(200).send(url);
}
generateSignedUrl().catch(console.error);
});

12
marketalarm-cors.json Normal file
View File

@@ -0,0 +1,12 @@
[
{
"origin": ["*"],
"responseHeader": [
"Content-Type",
"Access-Control-Allow-Origin",
"x-goog-resumable"
],
"method": ["GET", "HEAD", "DELETE", "POST", "PUT", "OPTIONS"],
"maxAgeSeconds": 3600
}
]

View File

@@ -0,0 +1,12 @@
{
"type": "service_account",
"project_id": "marketalarm",
"private_key_id": "d4b71394407eb3dba9e431851dab60b198d6985d",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDTE6dkFr0bzDXg\n7ghMxkzq8cajqqqes9JZVqsXh+b/kFJYmEImFUILJJZdI080KM2sEYsIapBCxhMP\nFH017f/gfH3jnRbp3c70hghNh8noSTsq7kPA4l25o8GQnJ6AS+nhy8umPjb4KzX9\nkmC6OOD4P8mAmGqhoUv4s2jld1cXNur6NJjCpjEd2cH3SUbI71oA3V/4W8aK4dvS\n660kLY0PRt7mCiITe0hbTUBZY48W2ijZ7wM2r0HUtPG9XEeGMGmNsC+qD2oWxUU3\nvnm7l1fEIUvLYF4GrLRDJDSkpChBXNcWhoGV2AOvuTc+yghU2+lJWqrKcpLlI23E\nlVJjt9UhAgMBAAECggEABatr8sxq+SQOf9hSIe3Me9Kc1nunrC42scFHRKBNxahJ\ndXw5B9FQPh738Cqhk0xEz6hlrln1Agj6HhRIz8U0r9R+z4TRRr6kfnWmBZAMShu0\nC4JW448abpAYx8CQ/CvRmq2GlF+/M+QBeqpLS8gPzyaKTB/5IBaKG8Bn0fXXQZ2e\n7RaTpGx62jq79omPwiKz0PMVBGZrzPu8Z4tW47muV51osdKSNVgsXb4gCZl28zN2\n6zzY1ZK7u89MesY8joILMHm8cw0oyv9o+RVGEa1I1nq2q1A8ftZny4p7kUA/ITZX\nEZ6SCOP87z9HeVCr8lzexcovD8uZCOTYpcfotlSjGQKBgQD1VVGU2bzExiV0XQGc\n8n6m4TR6Y9zwXBiQPe0rXPZhvsj8QMTXk+L0ejCo4m7NF1dEyH6u+qX6wjNL1Hm9\nN/ZuDFqYtd9w6cQ8CtDZ6QZIE60k6tLQhMNRNMvHdMfedq+VOz3LX6TdyTnv8dP3\nbEsD8wIfFd6t5wNgeZkbKsNxBwKBgQDcQQsUppjglGpUoz7lGHKbFcKMPpIj9fMY\nfze1DXeTAtHGxGm2F10WZvxOEs4DCOUllBlarL5xDAJIJHk/NYlgnI6MJXMLro6d\nsb4iNTUuJKdqAijyOaZQUADJpdYKGwu5y66PUOuojWFV9kiamquXduJ9jzOa1vr1\nSJPUy2YGlwKBgQDNJrpgwa8z0QozAy89Ih68x+fNTMLNkAXOYKp6L3OsixCguDyi\nlP0dOSyFnUvQXutQDmS5R8oSJeElURk4HJsKrXP47WVak3DQUK8S+eSR0zpfe6os\nSkjWGFMriEE2i4MKRI7JCULhX8r+FfgNl9YnCEfG3M/oFhzhyO06JYlncwKBgF6n\nBSAGyEQbA+cDkI/bhcToAQdMDHmvxJyOb147P1vKJmSJG/TI7ZQnBd53blkXhYI0\ntwCko+LpCkH+iqyDUVpXbVsE7P/kMB3MuKzyuLvvvJJuAzK1W6e/+daukeEd5lge\nFBI68EsrFt1eTa1DMuKQkJzs4Xx1TrwCSKV2E45ZAoGBAIZkXyAOhwqCxwDF7B69\nt/7CWs0gPGqp6lFO7fgt7jPmcmSEr/xgUbBDFwd7D49jpXVgCEtr1Bd6MItlu/Ns\nXgXyOa5LPQmglF7UtnvuQLASBy5X6boKaf3sz7I5eho1kXczPGQUHfR5e0DaTND3\nTi2NLIAUci8T7hc8mONdeEHD\n-----END PRIVATE KEY-----\n",
"client_email": "marketalarm-photos-service-acc@marketalarm.iam.gserviceaccount.com",
"client_id": "115644068453290488813",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/marketalarm-photos-service-acc%40marketalarm.iam.gserviceaccount.com"
}

View File

@@ -1,12 +0,0 @@
{
"type": "service_account",
"project_id": "marketalarm",
"private_key_id": "dd909e0aeef15920e7fc18229ce421246c143f90",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDLedKH5aM2yOo5\nPh8XRl8HsGZOdq4RveBT8ulJw33KexMckvCkRctSJkRPdbXF3I+N25/WihiUKEXy\nBlVqmDOCEM4qo4/sLllN7hxsoGdIGhnMEAzf8vO1/+NBdErKdu6lRW84GY29gVTH\nQBv54gMcbr2jvBW9qGqmx0Tn0DI0w3BLDd45Sz/yqhE42jmYLDEZ96E1uOR1jlG7\nwdaVlv0r3xdgmV51SjeZevlJxbWFjYCO7UXzhkvldklAjEK2Bgf0hkx9GPUHlo8u\n4TAePLXw35vx7wfrFG8cfDoPPAcB3O5WEzxX9z9/bdG4OZchcTWhguUfEGQ9Oq8Y\n3qnRpg+HAgMBAAECggEAFUWtpGZ2Cz6y+fwMHQ9O1Qt0jqRqq1Ep+CzPhdYpuvbl\n9xlHjiz7xiFZB+Oa9s4Jtf9tdOzoB+kz8ssFuAikbeca3qtN2xe3X2XS0+prEcck\nxkgxSGJqZy8Sz598SDFp3p5lM7y8LEEun0wNALFHuPu82LbLoRHP4JK5mfCSpyBN\nztXE+WFTFsNubgE3kqhZopVXXfQ+Wl43Gfx9jnFkFvxonL23soPP8JLd/Px7rsIZ\nFcaxCGjw3YsuEc3vSO6M7HY2rSx9ho+uSX9XpEb50p6bHXBTAb0ESE4Xf/uslVA5\nCqCxkzf7wB4RzveR6gLrDeTlg4Y5zN+Ioxzq6+8vSQKBgQDlGrAghbfAN6NemR8n\naiYTZ+cvZMigYuy9jSNMnCLmTYDe66r9+PWfT0jQdwaUFmhSbC3939goBAUiZlB9\nAfP4ygFR/TLJXHSXAt6c/9+VpU78lRbGCqs/RGSvH7NyObwSd1wzRXOXtzegXtjf\nz0hSYcOAZljayTEt/RX3fpERzwKBgQDjXOuB6dFRqEmNtetmB4qxBk1stHaFstiG\nG2Rcis09IlCPb0uom7wOxo0CBq8J/3QZWOouwkiXzaMoy8X/UuSJWJ8g0hgGhtNl\n/zlwSnLxaxpWdrP1zQ4vltcdmwc0oDGCjoXbUsJ3L7K/quRfdM1vyEcfNWkdxCus\nY6ugQ7isyQKBgQDN/lcKhvCWxfAAaJEYcVrW6/90H5w8iXXvYO2yPlkq1djfluph\n/O1sVm9T8RFbKWKXaWlY8WF7aVHsgi4wmAbzVT4mqBB3+Mdj2FKsu2wfM0l31d1q\nJ8Gd2zLkOw6vz7WIrQWbnAC5EyXS7jT113xhhkGwO1X9MhUkEoEjzQtHBQKBgGAK\nzGEgiA9aa1e1VS7QWMHWy7XztW1c0yIzR/3flDsS17z/YpJi1tnW/ZGxiRdMFZrv\neF0wLMITV6zQB1+HgIqUKQQQO53mLj6TxYutp0hb2dBUbEiUyj1IFq6m4jBUyxU/\nZ0PyfbsjJvrYEYhRKsbhb0m7oh+00k4L/F/Cu6whAoGAK/lwGbnxx4b+2bHLizol\nC1SCWfehwopZ6+RJDlh+nmdotLHqoJUuywQ4w1+3IfR4gfzsDsOo4hctyNDZXvK/\n5xDR5WpCXNDi1xLDajU5DcHPu+IqltvXe/KUEnEQdogIwsQMigp/MTNDy4tqVbaf\nDDaHojsNuJRgD2iek9vuciw=\n-----END PRIVATE KEY-----\n",
"client_email": "kivi-original-photos-id@marketalarm.iam.gserviceaccount.com",
"client_id": "105188302286128652978",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/kivi-original-photos-id%40marketalarm.iam.gserviceaccount.com"
}

147
package-lock.json generated
View File

@@ -13,9 +13,9 @@
}
},
"@google-cloud/common": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-2.3.0.tgz",
"integrity": "sha512-nmIyi3q/FL2j6ZJ61xK/863DoJEZayI2/W/iCgwrCYUYsem277XO45MBTAimjgiKBCA0c9InmQyfT48h/IK4jg==",
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-2.4.0.tgz",
"integrity": "sha512-zWFjBS35eI9leAHhjfeOYlK5Plcuj/77EzstnrJIZbKgF/nkqjcQuGiMCpzCwOfPyUbz8ZaEOYgbHa759AKbjg==",
"requires": {
"@google-cloud/projectify": "^1.0.0",
"@google-cloud/promisify": "^1.0.0",
@@ -48,9 +48,9 @@
"integrity": "sha512-VccZDcOql77obTnFh0TbNED/6ZbbmHDf8UMNnzO1d5g9V0Htfm4k5cllY8P1tJsRKC3zWYGRLaViiupcgVjBoQ=="
},
"@google-cloud/storage": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@google-cloud/storage/-/storage-4.3.1.tgz",
"integrity": "sha512-/i7tAcUZDQNDs8/+oN+U2mOXdWdP2eld0pFKLkpthmWmaD89JQlrgHAFL7uvlgCSbaD7YxgbSyJebgd6YBgMgQ==",
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@google-cloud/storage/-/storage-4.5.0.tgz",
"integrity": "sha512-ZLFcR6CiP1AnYBA9eTtASF9Dy3wjYmGx+HZiy/LsIPN41wyBTn9yAjIOxRHiteqzX3uQzZ+VJNCB/DmTU33CeQ==",
"requires": {
"@google-cloud/common": "^2.1.1",
"@google-cloud/paginator": "^2.0.0",
@@ -82,9 +82,9 @@
"integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA=="
},
"readable-stream": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.5.0.tgz",
"integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==",
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"requires": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
@@ -188,9 +188,27 @@
}
},
"agent-base": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz",
"integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g=="
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz",
"integrity": "sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw==",
"requires": {
"debug": "4"
},
"dependencies": {
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}
}
},
"ajv": {
"version": "6.10.0",
@@ -865,6 +883,15 @@
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
},
"cors": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
"requires": {
"object-assign": "^4",
"vary": "^1"
}
},
"create-error-class": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz",
@@ -1483,9 +1510,9 @@
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
},
"fast-text-encoding": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.0.tgz",
"integrity": "sha512-R9bHCvweUxxwkDwhjav5vxpFvdPGlVngtqmx4pIZfSUhM/Q4NiIUHB456BAf+Q1Nwu3HEZYONtu+Rya+af4jiQ=="
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.1.tgz",
"integrity": "sha512-x4FEgaz3zNRtJfLFqJmHWxkMDDvXVtaznj2V9jiP8ACUJrUgist4bP9FmDL2Vew2Y9mEQI/tG4GqabaitYp9CQ=="
},
"fill-range": {
"version": "4.0.0",
@@ -2146,13 +2173,13 @@
}
},
"gaxios": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-2.3.0.tgz",
"integrity": "sha512-VgC4JKJQAAAGK5rFZbPcS5mXsdIYVMIUJOxMjSOkYdfhB74R0L6y8PFQDdS0r1ObG6hdP11e71EjHh3xbI+6fQ==",
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-2.3.2.tgz",
"integrity": "sha512-K/+py7UvKRDaEwEKlLiRKrFr+wjGjsMz5qH7Vs549QJS7cpSCOT/BbWL7pzqECflc46FcNPipjSfB+V1m8PAhw==",
"requires": {
"abort-controller": "^3.0.0",
"extend": "^3.0.2",
"https-proxy-agent": "^4.0.0",
"https-proxy-agent": "^5.0.0",
"is-stream": "^2.0.0",
"node-fetch": "^2.3.0"
},
@@ -2165,9 +2192,9 @@
}
},
"gcp-metadata": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-3.3.1.tgz",
"integrity": "sha512-RrASg1HaVAxoB9Q/8sYfJ++v9PMiiqIgOrOxZeagMgS4osZtICT1lKBx2uvzYgwetxj8i6K99Z0iuKMg7WraTg==",
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-3.5.0.tgz",
"integrity": "sha512-ZQf+DLZ5aKcRpLzYUyBS3yo3N0JSa82lNDO8rj3nMSlovLcz2riKFBsYgDzeXcv75oo5eqB2lx+B14UvPoCRnA==",
"requires": {
"gaxios": "^2.1.0",
"json-bigint": "^0.3.0"
@@ -2187,11 +2214,11 @@
},
"dependencies": {
"configstore": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.0.tgz",
"integrity": "sha512-eE/hvMs7qw7DlcB5JPRnthmrITuHMmACUJAp89v6PT6iOqzoLS7HRWhBtuHMlhNHo2AhUSA/3Dh1bKNJHcublQ==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz",
"integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==",
"requires": {
"dot-prop": "^5.1.0",
"dot-prop": "^5.2.0",
"graceful-fs": "^4.1.2",
"make-dir": "^3.0.0",
"unique-string": "^2.0.0",
@@ -2239,9 +2266,9 @@
}
},
"write-file-atomic": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.1.tgz",
"integrity": "sha512-JPStrIyyVJ6oCSz/691fAjFtefZ6q+fP6tm+OS4Qw6o+TGQxNp1ziY2PgS+X/m0V8OWhZiO/m4xSj+Pr4RrZvw==",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz",
"integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==",
"requires": {
"imurmurhash": "^0.1.4",
"is-typedarray": "^1.0.0",
@@ -2327,15 +2354,16 @@
}
},
"google-auth-library": {
"version": "5.9.2",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.9.2.tgz",
"integrity": "sha512-rBE1YTOZ3/Hu6Mojkr+UUmbdc/F28hyMGYEGxjyfVA9ZFmq12oqS3AeftX4h9XpdVIcxPooSo8hECYGT6B9XqQ==",
"version": "5.10.1",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
"integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
"requires": {
"arrify": "^2.0.0",
"base64-js": "^1.3.0",
"ecdsa-sig-formatter": "^1.0.11",
"fast-text-encoding": "^1.0.0",
"gaxios": "^2.1.0",
"gcp-metadata": "^3.3.0",
"gcp-metadata": "^3.4.0",
"gtoken": "^4.1.0",
"jws": "^4.0.0",
"lru-cache": "^5.0.0"
@@ -2563,14 +2591,6 @@
"debug": "4"
},
"dependencies": {
"agent-base": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz",
"integrity": "sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw==",
"requires": {
"debug": "4"
}
},
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
@@ -2597,11 +2617,11 @@
}
},
"https-proxy-agent": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz",
"integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==",
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz",
"integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==",
"requires": {
"agent-base": "5",
"agent-base": "6",
"debug": "4"
},
"dependencies": {
@@ -3381,6 +3401,11 @@
"resolved": "https://registry.npmjs.org/obj-extend/-/obj-extend-0.1.0.tgz",
"integrity": "sha1-u0SKR3X7les0p4H5CLusLfI9u1s="
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"object-copy": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz",
@@ -4520,38 +4545,6 @@
"node-fetch": "^2.2.0",
"stream-events": "^1.0.5",
"uuid": "^3.3.2"
},
"dependencies": {
"agent-base": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz",
"integrity": "sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw==",
"requires": {
"debug": "4"
}
},
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
},
"https-proxy-agent": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz",
"integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==",
"requires": {
"agent-base": "6",
"debug": "4"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}
}
},
"term-size": {

View File

@@ -30,12 +30,13 @@
},
"dependencies": {
"2checkout-node": "0.0.1",
"@google-cloud/storage": "^4.3.1",
"@google-cloud/storage": "^4.5.0",
"@sendgrid/mail": "^6.3.1",
"aws-sdk": "^2.422.0",
"bluebird": "^3.5.5",
"cheerio": "^1.0.0-rc.2",
"compression": "^1.7.4",
"cors": "^2.8.5",
"dotenv": "^7.0.0",
"ejs": "^2.6.1",
"eslint-plugin-prettier": "^3.1.2",