Added getAuthorizedCollection method to CollectionDataService

This commit is contained in:
Giuseppe Digilio
2019-07-25 13:00:26 +02:00
parent 0ab2ca1880
commit 82426700fd

View File

@@ -41,11 +41,26 @@ export class CollectionDataService extends ComColDataService<Collection> {
super(); super();
} }
/**
* Get all collections whom user has authorization to submit
*
* @return Observable<RemoteData<PaginatedList<Collection>>>
* collection list
*/
getAuthorizedCollection(): Observable<RemoteData<PaginatedList<Collection>>> {
const searchHref = 'findAuthorized';
const options = new FindAllOptions();
options.elementsPerPage = 1000;
return this.searchBy(searchHref, options).pipe(
filter((collections: RemoteData<PaginatedList<Collection>>) => !collections.isResponsePending));
}
/** /**
* Get all collections whom user has authorization to submit to by community * Get all collections whom user has authorization to submit to by community
* *
* @return boolean * @return Observable<RemoteData<PaginatedList<Collection>>>
* true if the user has at least one collection to submit to * collection list
*/ */
getAuthorizedCollectionByCommunity(communityId): Observable<RemoteData<PaginatedList<Collection>>> { getAuthorizedCollectionByCommunity(communityId): Observable<RemoteData<PaginatedList<Collection>>> {
const searchHref = 'findAuthorizedByCommunity'; const searchHref = 'findAuthorizedByCommunity';