model Itemype added

This commit is contained in:
Daniel Herrero 2017-12-19 14:58:14 +01:00
parent adb2f60fef
commit 29c75d3d8d
5 changed files with 37 additions and 4 deletions

View File

@ -8,6 +8,7 @@
<div><span translate>Category</span>: <b>{{$ctrl.item.category}}</b></div> <div><span translate>Category</span>: <b>{{$ctrl.item.category}}</b></div>
<div><span translate>Description</span>: <b>{{$ctrl.item.description}}</b></div> <div><span translate>Description</span>: <b>{{$ctrl.item.description}}</b></div>
<div><span translate>Size</span>: <b>{{$ctrl.item.size}}</b></div> <div><span translate>Size</span>: <b>{{$ctrl.item.size}}</b></div>
<div><span translate>Type</span>: <b>{{$ctrl.item.itemType.name}}</b></div>
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
</a> </a>

View File

@ -6,13 +6,13 @@ module.exports = Self => {
where: {}, where: {},
skip: (params.page - 1) * params.size, skip: (params.page - 1) * params.size,
limit: params.size, limit: params.size,
order: params.order || 'relevancy DESC'/* , order: params.order || 'relevancy DESC',
include: { include: {
relation: "greugeType", relation: "itemType",
scope: { scope: {
fields: ["id", "name"] fields: ["id", "name"]
} }
} */ }
}; };
return filter; return filter;

View File

@ -0,0 +1,23 @@
{
"name": "ItemType",
"base": "VnModel",
"options": {
"mysql": {
"table": "itemType",
"database": "vn"
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"name": {
"type": "String"
},
"life": {
"type": "Number"
}
}
}

View File

@ -40,5 +40,12 @@
"image": { "image": {
"type": "String" "type": "String"
} }
},
"relations": {
"itemType": {
"type": "belongsTo",
"model": "ItemType",
"foreignKey": "typeFk"
}
} }
} }

View File

@ -26,6 +26,8 @@
}, },
"Item": { "Item": {
"dataSource": "vn" "dataSource": "vn"
},
"ItemType": {
"dataSource": "vn"
} }
} }