mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
64387: HAL endpoint refactoring
This commit is contained in:

committed by
Marie Verdonck

parent
ee140e623a
commit
aed4db6289
@@ -6,6 +6,8 @@ import { ObjectCacheService } from '../cache/object-cache.service';
|
|||||||
import { CommunityDataService } from './community-data.service';
|
import { CommunityDataService } from './community-data.service';
|
||||||
|
|
||||||
import { DataService } from './data.service';
|
import { DataService } from './data.service';
|
||||||
|
import { PaginatedList } from './paginated-list';
|
||||||
|
import { RemoteData } from './remote-data';
|
||||||
import { FindListOptions, FindByIDRequest } from './request.models';
|
import { FindListOptions, FindByIDRequest } from './request.models';
|
||||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||||
import { getResponseFromEntry } from '../shared/operators';
|
import { getResponseFromEntry } from '../shared/operators';
|
||||||
@@ -57,4 +59,8 @@ export abstract class ComColDataService<T extends CacheableObject> extends DataS
|
|||||||
return observableMerge(errorResponses, successResponses).pipe(distinctUntilChanged(), share());
|
return observableMerge(errorResponses, successResponses).pipe(distinctUntilChanged(), share());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public findByParentCommunity(parentUUID: string): Observable<RemoteData<PaginatedList<T>>> {
|
||||||
|
this.halService.getEndpoint(`communities/${parentUUID}/collections`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -247,4 +247,14 @@ export class ItemDataService extends DataService<Item> {
|
|||||||
map((request: RequestEntry) => request.response)
|
map((request: RequestEntry) => request.response)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the endpoint for an item's bitstreams
|
||||||
|
* @param itemId
|
||||||
|
*/
|
||||||
|
public getBitstreamsEndpoint(itemId: string): Observable<string> {
|
||||||
|
return this.halService.getEndpoint(this.linkPath).pipe(
|
||||||
|
switchMap((url: string) => this.halService.getEndpoint('bitstreams', `${url}/${itemId}`))
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -43,8 +43,8 @@ export class HALEndpointService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getEndpoint(linkPath: string): Observable<string> {
|
public getEndpoint(linkPath: string, startHref?: string): Observable<string> {
|
||||||
return this.getEndpointAt(this.getRootHref(), ...linkPath.split('/'));
|
return this.getEndpointAt(startHref || this.getRootHref(), ...linkPath.split('/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user