perf: refs #6321 remove comments
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Javier Segarra 2025-01-31 01:17:23 +01:00
parent 2574e59c71
commit 767c891317
5 changed files with 14 additions and 30 deletions

View File

@ -1,14 +1,16 @@
module.exports = Self => { module.exports = Self => {
Self.remoteMethodCtx('getSimilar', { Self.remoteMethodCtx('getSimilar', {
description: 'Returns the ', description: 'Returns list of items with similar item requested',
accessType: 'READ', accessType: 'READ',
accepts: [{ accepts: [
arg: 'filter', {
type: 'Object', arg: 'filter',
required: true, type: 'Object',
description: 'Filter defining where and paginated data', required: true,
http: {source: 'query'} description: 'Filter defining where and paginated data',
}], http: {source: 'query'}
}
],
returns: { returns: {
type: ['Object'], type: ['Object'],
root: true root: true

View File

@ -73,7 +73,7 @@ module.exports = Self => {
query: [sale.ticketFk] query: [sale.ticketFk]
}; };
const salesPerson = await Self.rawSql(salesPersonQuery.sql, salesPersonQuery.query, myOptions); const salesPerson = await Self.rawSql(salesPersonQuery.sql, salesPersonQuery.query, myOptions);
const url = await Self.app.models.Url.getUrl(); const url = await models.Url.getUrl();
const substitution = await models.Item.findById(substitutionFk, { const substitution = await models.Item.findById(substitutionFk, {
fields: ['id', 'name', 'longName'] fields: ['id', 'name', 'longName']
}, myOptions); }, myOptions);

View File

@ -146,8 +146,7 @@ module.exports = Self => {
stmt.merge({ stmt.merge({
sql: `AND ts.alertLevel=?`, params: [filter.where.stateFk]}); sql: `AND ts.alertLevel=?`, params: [filter.where.stateFk]});
} }
// }
// stmt.merge(conn.makeWhere(filter.where));
const sql = ParameterizedSQL.join([stmt], ';'); const sql = ParameterizedSQL.join([stmt], ';');
const result = await conn.executeStmt(sql, myOptions); const result = await conn.executeStmt(sql, myOptions);
return result; return result;

View File

@ -62,24 +62,6 @@ describe('Item Lack', () => {
} }
}); });
// it('should return data with filter.name', async() => {
// const tx = await models.Ticket.beginTransaction({});
// const options = {transaction: tx};
// const filter = {
// name: 1
// };
// try {
// const result = await models.Ticket.itemLack(ctx, filter, options);
// expect(result.length).toEqual(1);
// await tx.rollback();
// } catch (e) {
// await tx.rollback();
// throw e;
// }
// });
it('should return data with filter.color', async() => { it('should return data with filter.color', async() => {
const tx = await models.Ticket.beginTransaction({}); const tx = await models.Ticket.beginTransaction({});

View File

@ -40,7 +40,6 @@ module.exports = Self => {
} }
try { try {
// const ticketsIds = ticket.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 Select t.id tid, s.id sid, count(s.id) count
FROM FROM
@ -56,6 +55,7 @@ module.exports = Self => {
result.push({ticket: tid, status: 'noSplit'}); result.push({ticket: tid, status: 'noSplit'});
continue; continue;
} }
const [, [{vNewTicket}]] = await Self.rawSql(` const [, [{vNewTicket}]] = await Self.rawSql(`
CALL vn.ticket_clone(?, @vNewTicket); CALL vn.ticket_clone(?, @vNewTicket);
SELECT @vNewTicket vNewTicket;`, SELECT @vNewTicket vNewTicket;`,
@ -69,6 +69,7 @@ module.exports = Self => {
const updateIsPicked = sales.map(({sid}) => Self.rawSql(` const updateIsPicked = sales.map(({sid}) => Self.rawSql(`
UPDATE vn.sale SET isPicked = (id = ?) WHERE ticketFk = ?`, UPDATE vn.sale SET isPicked = (id = ?) WHERE ticketFk = ?`,
[sid, tid], myOptions)); [sid, tid], myOptions));
await Promise.all(updateIsPicked); await Promise.all(updateIsPicked);
await Self.transferSales(ctx, tid, vNewTicket, sales, myOptions); await Self.transferSales(ctx, tid, vNewTicket, sales, myOptions);