From 93388461d184de74a0fe01df4083c48b79fc37ae Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 28 Nov 2024 08:59:08 +0100 Subject: [PATCH] fix: refs #7266 Changed method name and corrections --- .../back/methods/entry/{print.js => labelSupplier.js} | 8 ++++---- modules/entry/back/models/entry.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) rename modules/entry/back/methods/entry/{print.js => labelSupplier.js} (89%) diff --git a/modules/entry/back/methods/entry/print.js b/modules/entry/back/methods/entry/labelSupplier.js similarity index 89% rename from modules/entry/back/methods/entry/print.js rename to modules/entry/back/methods/entry/labelSupplier.js index b604adce6..32d80c427 100644 --- a/modules/entry/back/methods/entry/print.js +++ b/modules/entry/back/methods/entry/labelSupplier.js @@ -1,6 +1,6 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethodCtx('print', { + Self.remoteMethodCtx('labelSupplier', { description: 'Print stickers of all entries', accessType: 'READ', accepts: [ @@ -28,13 +28,13 @@ module.exports = Self => { } ], http: { - path: '/:id/print', + path: '/:id/labelSupplier', verb: 'GET' }, accessScopes: ['DEFAULT', 'read:multimedia'] }); - Self.print = async function(ctx, id, options) { + Self.labelSupplier = async function(ctx, id, options) { const models = Self.app.models; const myOptions = {}; if (typeof options == 'object') @@ -49,7 +49,7 @@ module.exports = Self => { if (buy.stickers < 1) continue; ctx.args.id = buy.id; ctx.args.copies = buy.stickers; - const pdfBuffer = await models.Entry.buyLabel(ctx, myOptions); + const pdfBuffer = await models.Entry.buyLabelSupplier(ctx, myOptions); await merger.add(new Uint8Array(pdfBuffer[0])); } diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js index 49c3d2ec3..dc5022ada 100644 --- a/modules/entry/back/models/entry.js +++ b/modules/entry/back/models/entry.js @@ -11,7 +11,7 @@ module.exports = Self => { require('../methods/entry/addFromPackaging')(Self); require('../methods/entry/addFromBuy')(Self); require('../methods/entry/buyLabel')(Self); - require('../methods/entry/print')(Self); + require('../methods/entry/labelSupplier')(Self); require('../methods/entry/buyLabelSupplier')(Self); Self.observe('before save', async function(ctx, options) {