refactor(db): export modules
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
544730eba4
commit
da09c4b346
|
@ -1,12 +1,9 @@
|
|||
const con = require('./connect');
|
||||
|
||||
function insertSmartTag(smartTagFk, shelving, level) {
|
||||
module.exports = function insertSmartTag(smartTagFk, shelving, level) {
|
||||
const sql = `INSERT INTO vn.smartTag (code, shelvingFk, level)
|
||||
VALUES (?, ?, ?)
|
||||
ON DUPLICATE KEY
|
||||
UPDATE shelvingFk = ?, level = ?;`;
|
||||
con.query(sql, [smartTagFk, shelving, level, shelving, level], function(err, result) {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
}
|
||||
exports.insertSmartTag = insertSmartTag;
|
||||
con.query(sql, [smartTagFk, shelving, level, shelving, level]);
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@ const con = require('./connect');
|
|||
|
||||
function insertTicket(ticket, smartTag) {
|
||||
const sql = `UPDATE vn.ticketCollection SET smartTagFk = ? WHERE ticketFk = ?`;
|
||||
con.query(sql, smartTag, ticket, function(err, result) {
|
||||
con.query(sql, [smartTag, ticket], function(err, result) {
|
||||
if (err) throw err;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ async function bindShelvingTag(smartTagFk, shelving, level) {
|
|||
if (filter.isSmartTag(smartTagFk)) {
|
||||
if (await filter.isShelving(shelving)) {
|
||||
insertShelving(shelvingId, smartTagFk); // al carry en ESL CLOUD SYSTEM
|
||||
insertSmartTag.insertSmartTag(smartTagFk, shelving, level); // en vn.smartTag
|
||||
insertSmartTag(smartTagFk, shelving, level); // en vn.smartTag
|
||||
} else
|
||||
return 'INVALID_PLATE';
|
||||
} else
|
||||
|
@ -41,6 +41,7 @@ async function insertShelving(shelvingId, smartTagFk) {
|
|||
const info = await dataLogIn.dataLogIn;
|
||||
const key = info.data.token;
|
||||
const currentUser = info.data.currentUser;
|
||||
|
||||
await got.post('http://app.etiquetaselectronicas.com:9999/item/batchImportItem', { // eslint-disable-line
|
||||
json: {
|
||||
agencyId: currentUser.agencyId,
|
||||
|
|
Reference in New Issue