diff --git a/loopback/common/methods/application/status.js b/loopback/common/methods/application/status.js new file mode 100644 index 000000000..43cfe5b60 --- /dev/null +++ b/loopback/common/methods/application/status.js @@ -0,0 +1,19 @@ + +module.exports = Self => { + Self.remoteMethod('status', { + description: 'Gets the backend status', + returns: { + type: 'Object', + root: true + }, + http: { + path: `/status`, + verb: 'GET' + } + }); + + Self.status = async() => { + await Self.rawSql(`SELECT TRUE`); + return true; + }; +}; diff --git a/loopback/common/models/application.js b/loopback/common/models/application.js new file mode 100644 index 000000000..ff7599fac --- /dev/null +++ b/loopback/common/models/application.js @@ -0,0 +1,4 @@ + +module.exports = function(Self) { + require('../methods/application/status')(Self); +}; diff --git a/loopback/common/models/application.json b/loopback/common/models/application.json new file mode 100644 index 000000000..0bb489720 --- /dev/null +++ b/loopback/common/models/application.json @@ -0,0 +1,12 @@ +{ + "name": "Application", + "base": "VnModel", + "acls": [ + { + "property": "status", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} diff --git a/loopback/server/model-config.json b/loopback/server/model-config.json index 530229c41..20e22accd 100644 --- a/loopback/server/model-config.json +++ b/loopback/server/model-config.json @@ -46,5 +46,8 @@ }, "Schema": { "dataSource": "vn" + }, + "Application": { + "dataSource": "vn" } } \ No newline at end of file