Skip to content

Instantly share code, notes, and snippets.

@gabovanlugo
Created July 25, 2017 17:01
Show Gist options
  • Save gabovanlugo/977a4dcce56fc40777746bb08f240e76 to your computer and use it in GitHub Desktop.
Save gabovanlugo/977a4dcce56fc40777746bb08f240e76 to your computer and use it in GitHub Desktop.
Factory with annotation
const adjustmentService = function (
// TODO Create Adjustments sercives
AdjustmentsQuery) {
'ngInject';
// TODO Create Adjustments sercives
const service = AdjustmentsQuery;
const pageSize = 20;
const data = () => {
return service.getList(1, pageSize, 'modificationDate', 'desc', 'mine')
.then(response => {
return {
total: response.data.totalCount
};
});
};
const get = (options) => {
return service.getList(
options.page.index,
pageSize,
options.order.column || 'modificationDate',
options.order.direction || 'desc',
'mine')
.then(response => {
return {
page: response.data.pageNumber,
data: response.data.data
};
});
};
return {
data,
get
};
};
export default adjustmentService;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment