perf(salix): refs #6321 #6321 updates

This commit is contained in:
Javier Segarra 2024-06-14 11:43:06 +02:00
parent ab85b8e703
commit e45ac6424c
4 changed files with 6 additions and 4 deletions

View File

@ -25,12 +25,12 @@ module.exports = Self => {
root: true root: true
}, },
http: { http: {
path: `/recalculatePrice`, path: `/replaceItem`,
verb: 'POST' verb: 'POST'
} }
}); });
Self.recalculatePrice = async(ctx, saleFk, itemFk, quantity, options) => { Self.replaceItem = async(ctx, saleFk, itemFk, quantity, options) => {
const myOptions = {userId: ctx.req.accessToken.userId}; const myOptions = {userId: ctx.req.accessToken.userId};
let tx; let tx;

View File

@ -47,6 +47,7 @@ module.exports = Self => {
s.itemFk itemFk, s.itemFk itemFk,
s.price price, s.price price,
al.code alertLevelCode, al.code alertLevelCode,
z.id zoneFk,
z.name zoneName, z.name zoneName,
z.hour theoreticalhour, z.hour theoreticalhour,
cn.isRookie, cn.isRookie,

View File

@ -1,6 +1,6 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
fdescribe('Item Lack', () => { describe('Item Lack', () => {
beforeEach(async() => { beforeEach(async() => {
ctx = { ctx = {
req: { req: {

View File

@ -36,7 +36,8 @@ module.exports = Self => {
try { try {
const ticketsIds = tickets.map(({ticketFk}, index) => ticketFk); const ticketsIds = tickets.map(({ticketFk}, index) => ticketFk);
const ticketsCount = await Self.rawSql(` const ticketsCount = await Self.rawSql(`
Select t.id tid, s.id sid, count(s.id) count from Select t.id tid, s.id sid, count(s.id) count
FROM
vn.ticket t vn.ticket t
LEFT JOIN vn.sale s LEFT JOIN vn.sale s
ON s.ticketFk = t.id ON s.ticketFk = t.id