7152-devToTest_2414 #2228
|
@ -1,6 +1,6 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('updateFromSale', {
|
||||
description: 'Returns a list of items and possible alternative locations',
|
||||
description: 'Update the visible items',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'saleFk',
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('getItemPackingType', {
|
||||
description: 'Retrieve the operator items',
|
||||
accessType: 'READ',
|
||||
returns: {
|
||||
type: 'string',
|
||||
},
|
||||
http: {
|
||||
path: `/getItemPackingType`,
|
||||
verb: 'GET'
|
||||
},
|
||||
});
|
||||
|
||||
Self.getItemPackingType = async ctx => {
|
||||
const userId = 9 ?? ctx.req.accessToken.userId;
|
||||
|
||||
const result = await Self.findOne({
|
||||
where: {
|
||||
workerFk: userId
|
||||
},
|
||||
include: {
|
||||
relation: 'itemPackingType',
|
||||
}
|
||||
});
|
||||
const itemPackingType = result.itemPackingType();
|
||||
return itemPackingType?.description;
|
||||
};
|
||||
};
|
|
@ -2,6 +2,7 @@ module.exports = Self => {
|
|||
require('../methods/operator/add')(Self);
|
||||
require('../methods/operator/getPrinter')(Self);
|
||||
require('../methods/operator/getAvailablePrinters')(Self);
|
||||
require('../methods/operator/getItemPackingType')(Self);
|
||||
|
||||
Self.observe('after save', async function(ctx) {
|
||||
const instance = ctx.data || ctx.instance;
|
||||
|
|
|
@ -43,6 +43,12 @@
|
|||
"type": "belongsTo",
|
||||
"model": "Printer",
|
||||
"foreignKey": "labelerFk"
|
||||
},
|
||||
"itemPackingType": {
|
||||
"type": "belongsTo",
|
||||
"model": "ItemPackingType",
|
||||
"foreignKey": "itemPackingTypeFk",
|
||||
"primaryKey": "code"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue