fix(db): params
gitea/smart-tag/pipeline/head This commit looks good
Details
gitea/smart-tag/pipeline/head This commit looks good
Details
This commit is contained in:
parent
7659ee5a55
commit
124771cb2d
|
@ -1,7 +1,7 @@
|
|||
const mysql = require('mysql');
|
||||
const config = require('../config');
|
||||
|
||||
const con = mysql.createConnection({
|
||||
module.exports = mysql.createConnection({
|
||||
user: config.db.user,
|
||||
password: config.db.password,
|
||||
host: config.db.host, // 'test-db.verdnatura.es',
|
||||
|
@ -9,5 +9,3 @@ const con = mysql.createConnection({
|
|||
database: config.db.database,
|
||||
insecureAuth: true
|
||||
});
|
||||
|
||||
exports.con = con;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const con = require('./connect.js');
|
||||
|
||||
con.con.connect(function(err) {
|
||||
con.connect(function(err) {
|
||||
if (err) throw err;
|
||||
let sql = `CREATE TABLE vn.smartTag (
|
||||
code varchar(12) NOT NULL,
|
||||
|
@ -13,7 +13,7 @@ con.con.connect(function(err) {
|
|||
ENGINE=InnoDB
|
||||
DEFAULT CHARSET=utf8
|
||||
COLLATE=utf8_general_ci;`;
|
||||
con.con.query(sql, function(err, result) {
|
||||
con.query(sql, function(err, result) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
const con = require('./connect');
|
||||
|
||||
function insertSmartTag(smartTagFk, shelving, level) {
|
||||
let sql = `INSERT INTO vn.smartTag (code, shelvingFk, level)
|
||||
VALUES ('${smartTagFk}', '${shelving}', ${level})
|
||||
const sql = `INSERT INTO vn.smartTag (code, shelvingFk, level)
|
||||
VALUES (?, ?, ?)
|
||||
ON DUPLICATE KEY
|
||||
UPDATE shelvingFk = '${shelving}', level = ${level};`;
|
||||
con.con.query(sql, function(err, result) {
|
||||
if (err)
|
||||
console.log(err);
|
||||
UPDATE shelvingFk = ?, level = ?;`;
|
||||
con.query(sql, [smartTagFk, shelving, level, shelving, level], function(err, result) {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
}
|
||||
exports.insertSmartTag = insertSmartTag;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const con = require('./connect');
|
||||
|
||||
function insertTicket(ticket, smartTag) {
|
||||
let sql = `UPDATE vn.ticketCollection SET smartTagFk = '${smartTag}' WHERE ticketFk = ${ticket}`;
|
||||
con.con.query(sql, function(err, result) {
|
||||
const sql = `UPDATE vn.ticketCollection SET smartTagFk = ? WHERE ticketFk = ?`;
|
||||
con.query(sql, smartTag, ticket, function(err, result) {
|
||||
if (err) throw err;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ function maxWagon(collectionFk, callback) {
|
|||
let consSql = `SELECT MAX(tc.wagon) AS MaxWagons
|
||||
FROM ticketCollection tc
|
||||
WHERE tc.collectionFk = ${collectionFk}`;
|
||||
con.con.query(consSql, function(err, result, fields) {
|
||||
con.query(consSql, function(err, result, fields) {
|
||||
callback(null, result);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ con.con.connect(function(err) {
|
|||
('A0A3B8299CD3', 'DEF', 3),
|
||||
('A0A3B8299CD4', 'DEF', 4)
|
||||
;`;
|
||||
con.con.query(sql, function(err, result) {
|
||||
con.query(sql, function(err, result) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
const con = require('./connect');
|
||||
|
||||
function selectCollectionSmartTag(collectionFk, callback) {
|
||||
let consSql = `SELECT * FROM vn.collectionSmartTag WHERE collectionFk = ${collectionFk};`;
|
||||
con.con.query(consSql, function(err, result, fields) {
|
||||
const consSql = `SELECT * FROM vn.collectionSmartTag WHERE collectionFk = ?;`;
|
||||
con.query(consSql, collectionFk, function(err, result, fields) {
|
||||
if (err) throw err;
|
||||
callback(null, result);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
const con = require('./connect');
|
||||
|
||||
function select(ticket, callback) {
|
||||
let consSql = `SELECT * FROM vn.collectionSmartTag WHERE ticketFk = ${ticket}`;
|
||||
con.con.query(consSql, function(err, result, fields) {
|
||||
let consSql = `SELECT * FROM vn.collectionSmartTag WHERE ticketFk = ?`;
|
||||
con.query(consSql, ticket, function(err, result, fields) {
|
||||
if (err) throw err;
|
||||
callback(null, result);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const info = (async() => {
|
||||
module.exports = (async() => {
|
||||
const config = require('../config');
|
||||
const encrypt = require('../utilities/encrypted');
|
||||
const got = require('got');
|
||||
|
@ -13,5 +13,3 @@ const info = (async() => {
|
|||
});
|
||||
return body;
|
||||
})();
|
||||
|
||||
exports.info = info;
|
||||
|
|
|
@ -4,11 +4,11 @@ const con = require('./db/connect');
|
|||
const config = require('./config');
|
||||
|
||||
const app = express();
|
||||
const dataLogIn = logIn.info;
|
||||
const dataLogIn = logIn;
|
||||
|
||||
exports.dataLogIn = dataLogIn;
|
||||
|
||||
con.con.connect(function(err) {});
|
||||
con.connect(function(err) {});
|
||||
|
||||
// app.use('/getNumShelving', require('./methods/setCollection__'));
|
||||
app.use('/bindShelving', require('./methods/bindShelvingTag')); // smartTagFk, shelving, level
|
||||
|
|
Reference in New Issue