feat: refs #6276 drop worker_getPrinter
This commit is contained in:
parent
d78e90687e
commit
f8faa958e6
|
@ -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();
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue