#6321 - Negative tickets #1945

Merged
jsegarra merged 146 commits from 6321_negative_tickets into dev 2025-02-11 08:45:33 +00:00
3 changed files with 40 additions and 1 deletions
Showing only changes of commit a943e39ba7 - Show all commits

View File

@ -1,4 +1,6 @@
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES
('Ticket','itemLack','READ','ALLOW','ROLE','employee'),
('Ticket','itemLackDetail','READ','ALLOW','ROLE','employee');
('Ticket','itemLackDetail','READ','ALLOW','ROLE','employee'),
('Ticket','itemLackOrigin','READ','ALLOW','ROLE','employee'),
('Ticket','negativeOrigin','READ','ALLOW','ROLE','employee');

View File

@ -0,0 +1,36 @@
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
module.exports = Self => {
Self.remoteMethod('negativeOrigin', {
description: 'Insert ticket negative into negativeOrigin',
accessType: 'READ',
accepts: [{
arg: 'ctx',
type: 'Object',
http: {source: 'context'}
}],
returns: {
type: 'object',
root: true
},
http: {
path: `/negativeOrigin`,
verb: 'GET'
}
});
Self.negativeOrigin = async(ctx, data, options) => {
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
const conn = Self.dataSource.connector;
const stmts = ['SELECT * FROM vn.negativeOrigin'];
jsegarra marked this conversation as resolved Outdated

esto no puede ser un find de loopback?

esto no puede ser un find de loopback?

La tabla negativeOrigin no está publicada en el model-config.json.
Pensé lo mismo, y supuse que si no se hizo fue por un motivo

La tabla negativeOrigin no está publicada en el model-config.json. Pensé lo mismo, y supuse que si no se hizo fue por un motivo

porque serás el primero que la necesita, publicala.

porque serás el primero que la necesita, publicala.

Okey, tomo nota para ahcer las modificaciones necesarias

Okey, tomo nota para ahcer las modificaciones necesarias
const sql = ParameterizedSQL.join(stmts, ';');
const result = await conn.executeStmt(sql, myOptions);
return result;
};
};

View File

@ -49,4 +49,5 @@ module.exports = function(Self) {
require('../methods/ticket/itemLack')(Self);
require('../methods/ticket/itemLackDetail')(Self);
require('../methods/ticket/itemLackOrigin')(Self);
require('../methods/ticket/negativeOrigin')(Self);
};