-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/origin/master' into feature/aut…
…horization * remotes/origin/master: Applied fixes from StyleCI Tidied user credentials updating now _user_profile has gone from usercontroller Added test for saving user without any changes Refactored all private keys with underscored keys to have double underscore, extended getAttributes function to ignore these keys Applied fixes from StyleCI Fixes to make the user model and services handle nested entities correctly. Abstracted common api service functionality to an AbstractApiService to cut down on the code duplication # Conflicts: # api/app/Http/Controllers/UserController.php
- Loading branch information
Showing
23 changed files
with
255 additions
and
205 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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
namespace common.services { | ||
|
||
export abstract class AbstractApiService { | ||
|
||
|
||
protected cachedPaginator:common.services.pagination.Paginator; | ||
|
||
constructor(protected ngRestAdapter:NgRestAdapter.INgRestAdapterService, | ||
protected paginationService:common.services.pagination.PaginationService, | ||
protected $q:ng.IQService) { | ||
} | ||
|
||
|
||
protected abstract modelFactory(data:any, exists?:boolean):common.models.IModel; | ||
protected abstract apiEndpoint():string; | ||
|
||
/** | ||
* Get the paginator | ||
* @returns {Paginator} | ||
*/ | ||
public getPaginator():common.services.pagination.Paginator { | ||
|
||
//cache the paginator so subsequent requests can be collection length-aware | ||
if (!this.cachedPaginator){ | ||
this.cachedPaginator = this.paginationService | ||
.getPaginatorInstance(this.apiEndpoint()) | ||
.setModelFactory(this.modelFactory); | ||
} | ||
|
||
return this.cachedPaginator; | ||
} | ||
|
||
/** | ||
* Get model response given an identifier (uuid or permalink) | ||
* @param identifier | ||
* @param withNested | ||
* @returns {ng.IHttpPromise<any>} | ||
*/ | ||
protected getModel(identifier:string, withNested:string[] = null):ng.IPromise<ng.IHttpPromiseCallbackArg<any>> { | ||
|
||
return this.ngRestAdapter.get(this.apiEndpoint()+'/'+identifier, { | ||
'With-Nested' : () => { | ||
if (!withNested){ | ||
return null; | ||
} | ||
return withNested.join(', '); | ||
} | ||
}); | ||
} | ||
|
||
|
||
} | ||
} | ||
|
||
|
||
|
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
Oops, something went wrong.