diff --git a/client/item/src/list/item-product.html b/client/item/src/list/item-product.html
index 916881e86..951eabfc5 100644
--- a/client/item/src/list/item-product.html
+++ b/client/item/src/list/item-product.html
@@ -8,6 +8,7 @@
Category: {{$ctrl.item.category}}
Description: {{$ctrl.item.description}}
Size: {{$ctrl.item.size}}
+ Type: {{$ctrl.item.itemType.name}}
diff --git a/services/item/common/methods/item/filter.js b/services/item/common/methods/item/filter.js
index c60c2222b..af21fb58b 100644
--- a/services/item/common/methods/item/filter.js
+++ b/services/item/common/methods/item/filter.js
@@ -6,13 +6,13 @@ module.exports = Self => {
where: {},
skip: (params.page - 1) * params.size,
limit: params.size,
- order: params.order || 'relevancy DESC'/* ,
+ order: params.order || 'relevancy DESC',
include: {
- relation: "greugeType",
+ relation: "itemType",
scope: {
fields: ["id", "name"]
}
- } */
+ }
};
return filter;
diff --git a/services/item/common/models/item-type.json b/services/item/common/models/item-type.json
new file mode 100644
index 000000000..d1f45c0db
--- /dev/null
+++ b/services/item/common/models/item-type.json
@@ -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"
+ }
+ }
+}
\ No newline at end of file
diff --git a/services/item/common/models/item.json b/services/item/common/models/item.json
index 0ccbb2e4c..6db749227 100644
--- a/services/item/common/models/item.json
+++ b/services/item/common/models/item.json
@@ -40,5 +40,12 @@
"image": {
"type": "String"
}
+ },
+ "relations": {
+ "itemType": {
+ "type": "belongsTo",
+ "model": "ItemType",
+ "foreignKey": "typeFk"
+ }
}
}
\ No newline at end of file
diff --git a/services/item/server/model-config.json b/services/item/server/model-config.json
index 60b0133b3..ab9410fb5 100644
--- a/services/item/server/model-config.json
+++ b/services/item/server/model-config.json
@@ -26,6 +26,8 @@
},
"Item": {
"dataSource": "vn"
+ },
+ "ItemType": {
+ "dataSource": "vn"
}
-
}