27 lines
659 B
JavaScript
27 lines
659 B
JavaScript
module.exports = function($resource) {
|
|
var Account = $resource(
|
|
'/api/account/:id', {
|
|
id: '@id'
|
|
}
|
|
);
|
|
|
|
Account.prototype.getBalances = function() {
|
|
var Balances = $resource('/api/account/:id/balances', {id: this.id});
|
|
|
|
this.balances = Balances.get();
|
|
};
|
|
|
|
Account.prototype.getBalance = function(begin, end) {
|
|
var Balance = $resource(
|
|
'/api/account/:id/balance', {
|
|
id: this.id,
|
|
begin: begin.format('YYYY-MM-DD'),
|
|
end: end.format('YYYY-MM-DD')
|
|
});
|
|
|
|
this.balance = Balance.get();
|
|
};
|
|
|
|
return Account;
|
|
};
|