master #2

Merged
alexm merged 10 commits from master into test 2022-04-04 10:02:43 +00:00
2 changed files with 8 additions and 13 deletions
Showing only changes of commit b9533f4790 - Show all commits

View File

@ -2,11 +2,11 @@ const mysql = require('mysql');
const config = require('../config');
const con = mysql.createConnection({
user: config.db.user,
password: config.db.password,
host: config.db.host, // 'test-db.verdnatura.es',
port: config.db.port,
database: config.db.database,
user: config.db.user,
password: config.db.password,
insecureAuth: true
});

View File

@ -1,18 +1,13 @@
const con = require('./connect');
function insertSmartTag(smartTagFk, shelving, level) {
let sql = `IF EXISTS(SELECT * FROM vn.smartTag WHERE code='${smartTagFk}')
THEN
UPDATE vn.smartTag
SET shelvingFk = '${shelving}', level = ${level}
WHERE code='${smartTagFk}';
ELSE
INSERT
INTO vn.smartTag (code, shelvingFk, level)
VALUES ('${smartTagFk}', '${shelving}', ${level});
END IF;`;
let sql = `INSERT INTO vn.smartTag (code, shelvingFk, level)
VALUES ('${smartTagFk}', '${shelving}', ${level})
ON DUPLICATE KEY
UPDATE shelvingFk = '${shelving}', level = ${level};`;
con.con.query(sql, function(err, result) {
console.log(err);
if (err)
console.log(err);
});
}
exports.insertSmartTag = insertSmartTag;