-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(payroll): Unify the interfaces for rubric configuration
Uses a unified interface for the rubric configuration service.
- Loading branch information
Showing
5 changed files
with
18 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 4 additions & 27 deletions
31
client/src/modules/payroll/rubric_configuration/configuration.service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,15 @@ | ||
angular.module('bhima.services') | ||
.service('ConfigurationService', ConfigurationService); | ||
|
||
ConfigurationService.$inject = ['PrototypeApiService', '$http', 'util']; | ||
ConfigurationService.$inject = ['PrototypeApiService']; | ||
|
||
/** | ||
* @class ConfigurationService | ||
* @extends PrototypeApiService | ||
* | ||
* @description | ||
* Encapsulates common requests to the /rubric_config/ URL. | ||
* Encapsulates common requests to the payroll /rubric_config/ URL. | ||
*/ | ||
function ConfigurationService(Api, $http, util) { | ||
const service = new Api('/rubric_config/'); | ||
|
||
service.getRubrics = getRubrics; | ||
service.setRubrics = setRubrics; | ||
|
||
// loads the configuration's rubrics | ||
function getRubrics(id) { | ||
if (angular.isUndefined(id)) { | ||
throw new Error( | ||
'Trying to get configuration of rubrics without the identity property', | ||
); | ||
} | ||
|
||
return $http.get(`/rubric_config/${id}/setting`) | ||
.then(util.unwrapHttpResponse); | ||
} | ||
|
||
// Sets Payroll Rubric's Configuration using the public API | ||
function setRubrics(id, data) { | ||
return $http.post(`/rubric_config/${id}/setting`, { configuration : data }) | ||
.then(util.unwrapHttpResponse); | ||
} | ||
|
||
return service; | ||
function ConfigurationService(Api) { | ||
return new Api('/payroll/rubric_config/'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 0 additions & 79 deletions
79
test/client-unit/services/rubricsConfigurationService.spec.js
This file was deleted.
Oops, something went wrong.