Refactored Data Services

This commit is contained in:
Art Lowel
2017-02-22 12:03:22 +01:00
parent 9364c32ae2
commit bb5575cd27
18 changed files with 215 additions and 201 deletions

View File

@@ -3,10 +3,10 @@ import { DataEffects } from "./data.effects";
import { Serializer } from "../serializer";
import { Collection } from "../shared/collection.model";
import { DSpaceRESTv2Serializer } from "../dspace-rest-v2/dspace-rest-v2.serializer";
import { CacheService } from "./cache/cache.service";
import { ObjectCacheService } from "../cache/object-cache.service";
import { DSpaceRESTv2Service } from "../dspace-rest-v2/dspace-rest-v2.service";
import { Actions, Effect } from "@ngrx/effects";
import { DataFindAllRequestAction, DataFindByIDRequestAction } from "./data.actions";
import { FindAllRequestCacheAction, FindByIDRequestCacheAction } from "../cache/request-cache.actions";
import { CollectionDataService } from "./collection-data.service";
@Injectable()
@@ -14,17 +14,17 @@ export class CollectionDataEffects extends DataEffects<Collection> {
constructor(
actions$: Actions,
restApi: DSpaceRESTv2Service,
cache: CacheService,
cache: ObjectCacheService,
dataService: CollectionDataService
) {
super(actions$, restApi, cache, dataService);
}
protected getFindAllEndpoint(action: DataFindAllRequestAction): string {
protected getFindAllEndpoint(action: FindAllRequestCacheAction): string {
return '/collections';
}
protected getFindByIdEndpoint(action: DataFindByIDRequestAction): string {
protected getFindByIdEndpoint(action: FindByIDRequestCacheAction): string {
return `/collections/${action.payload.resourceID}`;
}