refs #6321 feat: negativeOrigin

This commit is contained in:
Javier Segarra 2024-03-22 22:44:37 +01:00
parent e085bc7f1e
commit a943e39ba7
3 changed files with 40 additions and 1 deletions

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'];
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);
};