mirror of
https://github.com/openMF/community-app.git
synced 2026-02-06 13:36:46 +00:00
108 lines
5.8 KiB
JavaScript
108 lines
5.8 KiB
JavaScript
(function(module) {
|
|
mifosX.services = _.extend(module, {
|
|
ResourceFactoryProvider: function() {
|
|
var baseUrl = "" , apiVer = "/mifosng-provider/api/v1";
|
|
this.setBaseUrl = function(url) {baseUrl = url;};
|
|
this.$get = ['$resource', function(resource) {
|
|
var defineResource = function(url, paramDefaults, actions) {
|
|
return resource(baseUrl + url, paramDefaults, actions);
|
|
};
|
|
return {
|
|
userResource: defineResource(apiVer + "/users/:userId", {}, {
|
|
getAllUsers: {method: 'GET', params: {fields: "id,firstname,lastname,username,officeName"}, isArray: true}
|
|
}),
|
|
roleResource: defineResource(apiVer + "/roles/:roleId", {}, {
|
|
getAllRoles: {method: 'GET', params: {}, isArray: true}
|
|
}),
|
|
officeResource: defineResource(apiVer + "/offices/:officeId", {officeId:"@officeId"}, {
|
|
getAllOffices: {method: 'GET', params: {}, isArray: true}
|
|
}),
|
|
clientResource: defineResource(apiVer + "/clients/:clientId/:anotherresource", {clientId:'@clientId',anotherresource:'@anotherresource'}, {
|
|
getAllClients: {method: 'GET', params: {}},
|
|
getAllClientDocuments: {method: 'GET', params: {}, isArray: true},
|
|
update: { method: 'PUT'}
|
|
}),
|
|
clientIdentifierResource: defineResource(apiVer + "/client_identifiers/:clientIdentityId/documents", {clientIdentityId:'@clientIdentityId'}, {
|
|
get: {method: 'GET', params: {}, isArray:true}
|
|
}),
|
|
clientAccountResource: defineResource(apiVer + "/clients/:clientId/accounts", {clientId:'@clientId'}, {
|
|
getAllClients: {method: 'GET', params: {}}
|
|
}),
|
|
clientNotesResource: defineResource(apiVer + "/clients/:clientId/notes", {clientId:'@clientId'}, {
|
|
getAllNotes: {method: 'GET', params: {}, isArray:true}
|
|
}),
|
|
clientTemplateResource: defineResource(apiVer + "/clients/template", {}, {
|
|
get: {method: 'GET', params: {}}
|
|
}),
|
|
DataTablesResource: defineResource(apiVer + "/datatables/:datatablename/:clientId", {datatablename:'@datatablename',clientId:'@clientId'}, {
|
|
getAllDataTables: {method: 'GET', params: {}, isArray:true},
|
|
getTableDetails: {method: 'GET', params: {}}
|
|
}),
|
|
loanProductResource: defineResource(apiVer + "/loanproducts/:loanProductId", {loanProductId:'@loanProductId'}, {
|
|
getAllLoanProducts: {method: 'GET', params: {}, isArray:true}
|
|
}),
|
|
chargeResource: defineResource(apiVer + "/charges/:chargeId", {chargeId:'@chargeId'}, {
|
|
getAllCharges: {method: 'GET', params: {}, isArray:true}
|
|
}),
|
|
savingProductResource: defineResource(apiVer + "/savingsproducts/:savingProductId", {savingProductId:'@savingProductId'}, {
|
|
getAllSavingProducts: {method: 'GET', params: {}, isArray:true}
|
|
}),
|
|
loanResource: defineResource(apiVer + "/loans/:loanId", {loanId:'@loanId'}, {
|
|
getAllLoans: {method: 'GET', params: {}},
|
|
}),
|
|
LoanAccountResource: defineResource(apiVer + "/loans/:loanId", {loanId:'@loanId'}, {
|
|
getLoanAccountDetails: {method: 'GET', params: {}}
|
|
}),
|
|
LoanDocumentResource: defineResource(apiVer + "/loans/:loanId/documents", {loanId:'@loanId'}, {
|
|
getLoanDocuments: {method: 'GET', params: {} , isArray: true}
|
|
}),
|
|
currencyConfigResource: defineResource(apiVer + "/currencies", {}, {
|
|
update: { method: 'PUT'}
|
|
}),
|
|
userListResource: defineResource(apiVer + "/users/:userId", {userId:'@userId'}, {
|
|
getAllUsers: {method: 'GET', params: {}, isArray: true},
|
|
update: { method: 'PUT' }
|
|
}),
|
|
userTemplateResource: defineResource(apiVer + "/users/template", {}, {
|
|
get: {method: 'GET', params: {}}
|
|
}),
|
|
employeeResource: defineResource(apiVer + "/staff/:staffId", {staffId:'@staffId'}, {
|
|
getAllEmployees: {method: 'GET', params: {}, isArray: true},
|
|
update: { method: 'PUT'}
|
|
}),
|
|
globalSearch: defineResource(apiVer + "/search", {query:'@query'}, {
|
|
search: { method: 'GET',
|
|
params: { query: '@query'} ,
|
|
isArray:true
|
|
}
|
|
}),
|
|
fundsResource: defineResource(apiVer + "/funds/:fundId", {fundId:'@fundId'}, {
|
|
getAllFunds: {method: 'GET', params: {}, isArray: true}
|
|
}),
|
|
accountingRulesResource: defineResource(apiVer + "/accountingrules", {}, {
|
|
getAllRules: {method: 'GET', params: {associations : 'all'}, isArray: true}
|
|
}),
|
|
accountCoaResource: defineResource(apiVer + "/glaccounts/:glAccountId", {glAccountId:'@glAccountId'}, {
|
|
getAllAccountCoas: {method: 'GET', params: {}, isArray: true},
|
|
update: { method: 'PUT' }
|
|
}),
|
|
accountCoaTemplateResource: defineResource(apiVer + "/glaccounts/template", {}, {
|
|
get: {method: 'GET', params: {}}
|
|
}),
|
|
journalEntriesResource: defineResource(apiVer + "/journalentries/:trxid", {trxid:'@transactionId'}, {
|
|
get: {method: 'GET', params: {transactionId:'@transactionId'}},
|
|
reverse: {method: 'POST', params:{command:'reverse'}},
|
|
search:{method: 'GET', params: {}}
|
|
}),
|
|
accountingClosureResource: defineResource(apiVer + "/glclosures", {}, {
|
|
get: {method: 'GET', params: {}, isArray:true}
|
|
})
|
|
};
|
|
}];
|
|
}
|
|
});
|
|
mifosX.ng.services.config(function($provide) {
|
|
$provide.provider('ResourceFactory', mifosX.services.ResourceFactoryProvider);
|
|
}).run(function($log) { $log.info("ResourceFactory initialized"); });
|
|
}(mifosX.services || {}));
|