WIP: 4774-translationsVn #3138

Draft
carlossa wants to merge 9 commits from 4774-translationsVn into dev
9 changed files with 188 additions and 0 deletions
Showing only changes of commit 3e0a7b3b6a - Show all commits

View File

@ -213,5 +213,23 @@
},
"CompanyI18n": {
"dataSource": "vn"
},
"ItemTypeI18n": {
"dataSource": "vn"
},
"InkI18n": {
"dataSource": "vn"
},
"OriginI18n": {
"dataSource": "vn"
},
"StateI18n": {
"dataSource": "vn"
},
"TagI18n": {
"dataSource": "vn"
},
"itemCategoryI18n": {
"dataSource": "vn"
}
}

22
back/models/inkI18n.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "InkI18n",
"base": "VnModel",
"options": {
"mysql": {
"table": "inkI18n"
}
},
"properties": {
"inkFk": {
"type": "number",
"id": 1
},
"lang": {
"type": "string",
"id": 2
},
"name": {
"type": "string"
}
}
}

View File

@ -0,0 +1,22 @@
{
"name": "ItemCategoryI18n",
"base": "VnModel",
"options": {
"mysql": {
"table": "itemCategoryI18n"
}
},
"properties": {
"categoryFk": {
"type": "number",
"id": 1
},
"lang": {
"type": "string",
"id": 2
},
"name": {
"type": "string"
}
}
}

View File

@ -0,0 +1,22 @@
{
"name": "ItemTypeI18n",
"base": "VnModel",
"options": {
"mysql": {
"table": "itemTypeI18n"
}
},
"properties": {
"typeFk": {
"type": "number",
"id": 1
},
"lang": {
"type": "string",
"id": 2
},
"name": {
"type": "string"
}
}
}

View File

@ -0,0 +1,22 @@
{
"name": "OriginI18n",
"base": "VnModel",
"options": {
"mysql": {
"table": "originI18n"
}
},
"properties": {
"originFk": {
"type": "number",
"id": 1
},
"lang": {
"type": "string",
"id": 2
},
"name": {
"type": "string"
}
}
}

View File

@ -0,0 +1,22 @@
{
"name": "StateI18n",
"base": "VnModel",
"options": {
"mysql": {
"table": "stateI18n"
}
},
"properties": {
"stateFk": {
"type": "number",
"id": 1
},
"lang": {
"type": "string",
"id": 2
},
"name": {
"type": "string"
}
}
}

22
back/models/tagI18n.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "TagI18n",
"base": "VnModel",
"options": {
"mysql": {
"table": "tagI18n"
}
},
"properties": {
"tagFk": {
"type": "number",
"id": 1
},
"lang": {
"type": "string",
"id": 2
},
"name": {
"type": "string"
}
}
}

View File

@ -0,0 +1,37 @@
module.exports = Self => {
Self.remoteMethod('getI18nTables', {
description: 'Return tables with name end with i18n',
accessType: 'READ',
accepts: [],
returns: {
type: 'Array',
root: true
},
http: {
path: `/get-i18n-tables`,
verb: 'GET'
}
});
Self.getI18nTables = async() => {
const tables = await Self.rawSql(`
SELECT c.table_name tableName, c.column_name primaryKey
FROM information_schema.columns c
WHERE
c.table_name LIKE '%i18n'
AND c.COLUMN_KEY = 'PRI'
AND c.COLUMN_NAME <> 'lang'`);
const columns = await Self.rawSql(`
SELECT c.table_name tableName, c.column_name field
FROM information_schema.columns c
WHERE
c.table_name LIKE '%i18n'
AND c.COLUMN_KEY <> 'PRI'
`);
for (const column of columns)
tables.find(t => t.tableName == column.tableName).field = column.field;
return tables;
};
};

View File

@ -5,4 +5,5 @@ module.exports = function(Self) {
require('../methods/application/executeProc')(Self);
require('../methods/application/executeFunc')(Self);
require('../methods/application/getEnumValues')(Self);
require('../methods/application/getI18nTables')(Self);
};