mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
Merge branch 'master' into w2p-68346_Bundles-in-edit-item-Updates
Conflicts: package.json src/app/+item-page/item-page-routing.module.ts src/app/core/cache/builders/remote-data-build.service.ts src/app/core/cache/server-sync-buffer.effects.ts src/app/core/core.module.ts src/app/core/data/bitstream-data.service.ts src/app/core/data/bundle-data.service.ts src/app/core/data/data.service.ts src/app/core/data/dso-change-analyzer.service.ts src/app/core/data/item-data.service.ts src/app/core/data/object-updates/object-updates.actions.ts src/app/core/shared/bitstream.model.ts src/app/core/shared/dspace-object.model.ts src/app/shared/mocks/mock-request.service.ts src/app/shared/shared.module.ts yarn.lock
This commit is contained in:
50
src/app/shared/utils/follow-link-config.model.ts
Normal file
50
src/app/shared/utils/follow-link-config.model.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { FindListOptions } from '../../core/data/request.models';
|
||||
import { HALResource } from '../../core/shared/hal-resource.model';
|
||||
|
||||
/**
|
||||
* A class to configure the retrieval of a {@link HALLink}
|
||||
*/
|
||||
export class FollowLinkConfig<R extends HALResource> {
|
||||
/**
|
||||
* The name of the link to fetch.
|
||||
* Can only be a {@link HALLink} of the object you're working with
|
||||
*/
|
||||
name: keyof R['_links'];
|
||||
|
||||
/**
|
||||
* {@link FindListOptions} for the query,
|
||||
* allows you to resolve the link using a certain page, or sorted
|
||||
* in a certain way
|
||||
*/
|
||||
findListOptions?: FindListOptions;
|
||||
|
||||
/**
|
||||
* A list of {@link FollowLinkConfig}s to
|
||||
* use on the retrieved object.
|
||||
*/
|
||||
linksToFollow?: Array<FollowLinkConfig<any>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A factory function for {@link FollowLinkConfig}s,
|
||||
* in order to create them in a less verbose way.
|
||||
*
|
||||
* @param linkName: the name of the link to fetch.
|
||||
* Can only be a {@link HALLink} of the object you're working with
|
||||
* @param findListOptions: {@link FindListOptions} for the query,
|
||||
* allows you to resolve the link using a certain page, or sorted
|
||||
* in a certain way
|
||||
* @param linksToFollow: a list of {@link FollowLinkConfig}s to
|
||||
* use on the retrieved object.
|
||||
*/
|
||||
export const followLink = <R extends HALResource>(
|
||||
linkName: keyof R['_links'],
|
||||
findListOptions?: FindListOptions,
|
||||
...linksToFollow: Array<FollowLinkConfig<any>>
|
||||
): FollowLinkConfig<R> => {
|
||||
return {
|
||||
name: linkName,
|
||||
findListOptions,
|
||||
linksToFollow
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user