#6276 createNewWarehouse methods migrated from silex to salix #1850

Merged
jorgep merged 158 commits from 6276-createNewWarehouse into dev 2024-03-06 11:32:11 +00:00
1 changed files with 0 additions and 38 deletions
Showing only changes of commit 428da6fe00 - Show all commits

View File

@ -1,38 +0,0 @@
module.exports = Self => {
Self.remoteMethodCtx('getPrinter', {
description: 'Gets user\'s printer',
accessType: 'READ',
http: {
path: `/getPrinter`,
verb: 'GET'
},
returns: {
type: ['object'],
root: true
},
});
Self.getPrinter = async ctx => {
const userId = ctx.req.accessToken.userId;
const operator = await Self.findOne({
include: [
{
relation: 'printer',
scope: {
fields: ['id', 'name'],
}
}
],
where: {
workerFk: userId
}
});
if (operator) {
const printer = operator.printer();
return Array.isArray(printer) ? printer : [printer];
}
return [];
};
};