diff --git a/back/model-config.json b/back/model-config.json index 5368769fd..efb148ee8 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -139,6 +139,9 @@ "StarredModule": { "dataSource": "vn" }, + "SaySimpleCountry": { + "dataSource": "vn" + }, "TempContainer": { "dataSource": "tempStorage" }, diff --git a/back/models/country.json b/back/models/country.json index 80d456702..ee72ae49d 100644 --- a/back/models/country.json +++ b/back/models/country.json @@ -44,6 +44,11 @@ "type": "belongsTo", "model": "Continent", "foreignKey": "continentFk" + }, + "saySimpleCountry": { + "type": "hasOne", + "model": "SaySimpleCountry", + "foreignKey": "countryFk" } }, "acls": [ @@ -54,4 +59,4 @@ "permission": "ALLOW" } ] -} +} \ No newline at end of file diff --git a/back/models/say-simple-country.json b/back/models/say-simple-country.json new file mode 100644 index 000000000..39acd5f0b --- /dev/null +++ b/back/models/say-simple-country.json @@ -0,0 +1,26 @@ +{ + "name": "SaySimpleCountry", + "base": "VnModel", + "options": { + "mysql": { + "table": "saySimpleCountry" + } + }, + "properties": { + "countryFk": { + "type": "number", + "id": true + }, + "channel": { + "type": "number" + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index f25a4aab4..7bb0ace84 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -4008,3 +4008,6 @@ UPDATE vn.department SET pbxQueue = '1000' WHERE name = "CAMARA"; UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS"; +INSERT INTO vn.saySimpleCountry (countryFk, channel) + VALUES (19, 1169), + (8, 1183); \ No newline at end of file diff --git a/db/versions/11330-greenMoss/00-firstScript.sql b/db/versions/11330-greenMoss/00-firstScript.sql new file mode 100644 index 000000000..e0ef77e2d --- /dev/null +++ b/db/versions/11330-greenMoss/00-firstScript.sql @@ -0,0 +1,6 @@ +CREATE TABLE IF NOT EXISTS vn.saySimpleCountry( + countryFk MEDIUMINT(8) UNSIGNED, + channel INT(4) COMMENT 'channel de whatsapp de saySimple', + PRIMARY KEY (countryFk), + CONSTRAINT `saySimpleCountry_FK` FOREIGN KEY (`countryFk`) REFERENCES vn.country (`id`) ON UPDATE CASCADE +); \ No newline at end of file diff --git a/modules/client/back/methods/client/summary.js b/modules/client/back/methods/client/summary.js index 8162096f0..9242fbd44 100644 --- a/modules/client/back/methods/client/summary.js +++ b/modules/client/back/methods/client/summary.js @@ -54,7 +54,10 @@ module.exports = Self => { { relation: 'country', scope: { - fields: ['name'] + fields: ['id', 'name'], + include: { + relation: 'saySimpleCountry', + } } }, {