From f8faa958e66f29cf83f4de2ee14a0a7f164fd801 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 19 Jan 2024 14:53:41 +0100 Subject: [PATCH] feat: refs #6276 drop worker_getPrinter --- .../methods/operator/getAvailablePrinters.js | 39 ------------------- modules/worker/back/models/operator.js | 1 - 2 files changed, 40 deletions(-) delete mode 100644 modules/worker/back/methods/operator/getAvailablePrinters.js diff --git a/modules/worker/back/methods/operator/getAvailablePrinters.js b/modules/worker/back/methods/operator/getAvailablePrinters.js deleted file mode 100644 index 2e787da2b..000000000 --- a/modules/worker/back/methods/operator/getAvailablePrinters.js +++ /dev/null @@ -1,39 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('getAvailablePrinters', { - description: 'Retrieve available printers for an user', - accessType: 'READ', - http: { - path: `/getAvailabePrinters`, - verb: 'GET' - }, - returns: { - type: ['object'], - }, - }); - - Self.getAvailablePrinters = async ctx => { - const userId = ctx.req.accessToken.userId; - - const operators = await Self.find({ - fields: [], - where: { - workerFk: userId, - }, - - include: { - relation: 'printer', - scope: { - fields: ['id', 'name'] - }, - where: { - isLabeler: {neq: 0} - } - } - }); - if (operators.length) { - return operators.map(operator => { - return operator.printer(); - }); - } - }; -}; diff --git a/modules/worker/back/models/operator.js b/modules/worker/back/models/operator.js index b4569d7f5..442ac343f 100644 --- a/modules/worker/back/models/operator.js +++ b/modules/worker/back/models/operator.js @@ -1,6 +1,5 @@ module.exports = Self => { require('../methods/operator/add')(Self); - require('../methods/operator/getAvailablePrinters')(Self); Self.observe('after save', async function(ctx) { const instance = ctx.data || ctx.instance;