feat: refs #6869 define model #3172
|
@ -79,6 +79,9 @@
|
|||
"ImageCollectionSize": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ImageConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ImageContainer": {
|
||||
"dataSource": "imageStorage"
|
||||
},
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "ImageConfig",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "hedera.imageConfig"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"url": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$authenticated",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('getItems', {
|
||||
description: 'shelving item list',
|
||||
accessType: 'READ',
|
||||
accepts: [{
|
||||
arg: 'code',
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Shelving code'
|
||||
}],
|
||||
returns: {
|
||||
type: 'object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/getItems`,
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.getItems = async(code, options) => {
|
||||
const models = Self.app.models;
|
||||
const myOptions = {};
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
const shelving = await models.Shelving.findOne({
|
||||
fields: ['priority', 'parkingFk'],
|
||||
include: {
|
||||
relation: 'parking',
|
||||
scope: {fields: ['code']}
|
||||
},
|
||||
where: {code}
|
||||
}, myOptions);
|
||||
|
||||
const itemShelvings = await Self.find({
|
||||
fields: ['itemFk', 'visible', 'packing', 'grouping', 'isChecked', 'available', 'buyFk'],
|
||||
include: {
|
||||
relation: 'item',
|
||||
scope: {fields: ['name', 'longName', 'size']}
|
||||
},
|
||||
where: {shelvingFk: code}
|
||||
}, myOptions);
|
||||
return {
|
||||
code: shelving.parking().code,
|
||||
priority: shelving.priority,
|
||||
itemShelvings,
|
||||
};
|
||||
// Add image from hedera.imageConfig
|
||||
};
|
||||
};
|
|
@ -5,5 +5,4 @@ module.exports = Self => {
|
|||
require('../methods/item-shelving/getAlternative')(Self);
|
||||
require('../methods/item-shelving/updateFromSale')(Self);
|
||||
require('../methods/item-shelving/getListItemNewer')(Self);
|
||||
require('../methods/item-shelving/getItems')(Self);
|
||||
};
|
||||
|
|
|
@ -41,6 +41,9 @@
|
|||
},
|
||||
"available": {
|
||||
"type": "number"
|
||||
},
|
||||
"buyFk": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -44,6 +44,12 @@
|
|||
"type": "belongsTo",
|
||||
"model": "Worker",
|
||||
"foreignKey": "id"
|
||||
},
|
||||
"itemShelving": {
|
||||
"type": "hasMany",
|
||||
"model": "ItemShelving",
|
||||
"foreignKey": "shelvingFk",
|
||||
"primaryKey": "code"
|
||||
jorgep marked this conversation as resolved
Outdated
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Eliminar esta linea.