diff --git a/back/model-config.json b/back/model-config.json index 5368769fd..364ffabdf 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -139,6 +139,12 @@ "StarredModule": { "dataSource": "vn" }, + "SaySimpleCountry": { + "dataSource": "vn" + }, + "SaySimpleConfig": { + "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-config.json b/back/models/say-simple-config.json new file mode 100644 index 000000000..edc4caa43 --- /dev/null +++ b/back/models/say-simple-config.json @@ -0,0 +1,26 @@ +{ + "name": "SaySimpleConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "saySimpleConfig" + } + }, + "properties": { + "id": { + "type": "number", + "id": true + }, + "url": { + "type": "string" + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$authenticated", + "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..adddddc02 --- /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": "$authenticated", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 8544686e8..68d8be097 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -4022,3 +4022,10 @@ INSERT INTO srt.buffer (id, x, y, `size`, `length`, stateFk, typeFk, isActive, c (10, 0, 2000, 500, 13000, 1, 1, 1, '05A', 5, 0, NULL, NULL, NULL, NULL, 0, 1, 1, NULL); +INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel) + VALUES (19, 1169), + (8, 1183), + (NULL, 1320); + +INSERT IGNORE INTO vn.saySimpleConfig (url) + VALUES ('saysimle-url-mock'); \ 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..127c8e40e --- /dev/null +++ b/db/versions/11330-greenMoss/00-firstScript.sql @@ -0,0 +1,16 @@ +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 +); + +CREATE TABLE IF NOT EXISTS vn.saySimpleConfig( + id INT AUTO_INCREMENT PRIMARY KEY, + url VARCHAR(255) NOT NULL +); + +INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel) + VALUES (19, 1169), + (8, 1183), + (NULL, 1320); \ 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', + } } }, {