diff --git a/server/fixtures/balances.json b/server/fixtures/balances.json new file mode 100644 index 0000000..88a8b61 --- /dev/null +++ b/server/fixtures/balances.json @@ -0,0 +1,23 @@ +{ + "success" : true, + "message" : "", + "result" : [{ + "Currency" : "DOGE", + "Balance" : 0.00000000, + "Available" : 0.00000000, + "Pending" : 0.00000000, + "CryptoAddress" : "DLxcEt3AatMyr2NTatzjsfHNoB9NT62HiF", + "Requested" : false, + "Uuid" : null + + }, { + "Currency" : "BTC", + "Balance" : 14.21549076, + "Available" : 14.21549076, + "Pending" : 0.00000000, + "CryptoAddress" : "1Mrcdr6715hjda34pdXuLqXcju6qgwHA31", + "Requested" : false, + "Uuid" : null + } + ] +} diff --git a/server/model-config.json b/server/model-config.json index 3f6b358..83fe975 100644 --- a/server/model-config.json +++ b/server/model-config.json @@ -29,5 +29,9 @@ "event": { "dataSource": "db", "public": true + }, + "balance": { + "dataSource": null, + "public": true } } diff --git a/server/models/balance.js b/server/models/balance.js new file mode 100644 index 0000000..0616194 --- /dev/null +++ b/server/models/balance.js @@ -0,0 +1,12 @@ +import fixtures from '../fixtures/balances.json' + +module.exports = function (Balance) { + Balance.getBalances = (cb) => { + cb(null, fixtures) + } + + Balance.remoteMethod('getBalances', { + http: { verb: 'get', path: '/' }, + returns: {type: 'array', root: true} + }) +} diff --git a/server/models/balance.json b/server/models/balance.json new file mode 100644 index 0000000..5aa7d50 --- /dev/null +++ b/server/models/balance.json @@ -0,0 +1,14 @@ +{ + "name": "balance", + "plural": "balances", + "base": "Model", + "idInjection": true, + "options": { + "validateUpsert": true + }, + "properties": {}, + "validations": [], + "relations": {}, + "acls": [], + "methods": {} +} diff --git a/server/models/market.json b/server/models/market.json index 8559730..c4f9bc0 100644 --- a/server/models/market.json +++ b/server/models/market.json @@ -6,6 +6,13 @@ "options": { "validateUpsert": true }, + "mixins": { + "SetupRemoteMethods": { + "disableAllExcept": [ + "find" + ] + } + }, "properties": { "name": { "type": "string", @@ -33,10 +40,5 @@ "validations": [], "relations": {}, "acls": [], - "methods": {}, - "mixins": { - "SetupRemoteMethods": { - "disableAllExcept": ["find"] - } - } + "methods": {} }