Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
Adding some fixtures to define the endpoint, refs #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Genar Trias Ortiz committed Dec 5, 2017
1 parent 75ca2b2 commit 5a5c513
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 6 deletions.
23 changes: 23 additions & 0 deletions server/fixtures/balances.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
4 changes: 4 additions & 0 deletions server/model-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
"event": {
"dataSource": "db",
"public": true
},
"balance": {
"dataSource": null,
"public": true
}
}
12 changes: 12 additions & 0 deletions server/models/balance.js
Original file line number Diff line number Diff line change
@@ -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}
})
}
14 changes: 14 additions & 0 deletions server/models/balance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "balance",
"plural": "balances",
"base": "Model",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}
14 changes: 8 additions & 6 deletions server/models/market.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
"options": {
"validateUpsert": true
},
"mixins": {
"SetupRemoteMethods": {
"disableAllExcept": [
"find"
]
}
},
"properties": {
"name": {
"type": "string",
Expand Down Expand Up @@ -33,10 +40,5 @@
"validations": [],
"relations": {},
"acls": [],
"methods": {},
"mixins": {
"SetupRemoteMethods": {
"disableAllExcept": ["find"]
}
}
"methods": {}
}

0 comments on commit 5a5c513

Please sign in to comment.