diff --git a/src/app/core/shared/bitstream.model.ts b/src/app/core/shared/bitstream.model.ts index 314818b482..baf2f82635 100644 --- a/src/app/core/shared/bitstream.model.ts +++ b/src/app/core/shared/bitstream.model.ts @@ -43,13 +43,14 @@ export class Bitstream extends DSpaceObject implements HALResource { bundle: HALLink; format: HALLink; content: HALLink; + thumbnail: HALLink; }; /** * The thumbnail for this Bitstream - * Needs to be resolved first, but isn't available as a {@link HALLink} yet - * Use BitstreamDataService.getThumbnailFor(…) for now. + * Will be undefined unless the thumbnail {@link HALLink} has been resolved. */ + @link(BITSTREAM, false, 'thumbnail') thumbnail?: Observable>; /** diff --git a/src/app/core/shared/item.model.ts b/src/app/core/shared/item.model.ts index 53eb5e3ce2..65265e76ad 100644 --- a/src/app/core/shared/item.model.ts +++ b/src/app/core/shared/item.model.ts @@ -19,6 +19,8 @@ import { ITEM } from './item.resource-type'; import { ChildHALResource } from './child-hal-resource.model'; import { Version } from './version.model'; import { VERSION } from './version.resource-type'; +import { BITSTREAM } from './bitstream.resource-type'; +import { Bitstream } from './bitstream.model'; /** * Class representing a DSpace Item @@ -69,6 +71,7 @@ export class Item extends DSpaceObject implements ChildHALResource { owningCollection: HALLink; templateItemOf: HALLink; version: HALLink; + thumbnail: HALLink; self: HALLink; }; @@ -100,6 +103,13 @@ export class Item extends DSpaceObject implements ChildHALResource { @link(RELATIONSHIP, true) relationships?: Observable>>; + /** + * The thumbnail for this Item + * Will be undefined unless the thumbnail {@link HALLink} has been resolved. + */ + @link(BITSTREAM, false, 'thumbnail') + thumbnail?: Observable>; + /** * Method that returns as which type of object this object should be rendered */ diff --git a/src/app/thumbnail/thumbnail.component.spec.ts b/src/app/thumbnail/thumbnail.component.spec.ts index bc9d159750..eea585f9f8 100644 --- a/src/app/thumbnail/thumbnail.component.spec.ts +++ b/src/app/thumbnail/thumbnail.component.spec.ts @@ -78,6 +78,7 @@ describe('ThumbnailComponent', () => { bundle: { href: 'bundle.url' }, format: { href: 'format.url' }, content: { href: 'content.url' }, + thumbnail: undefined, }; }); @@ -126,6 +127,7 @@ describe('ThumbnailComponent', () => { bundle: { href: 'bundle.url' }, format: { href: 'format.url' }, content: { href: 'content.url' }, + thumbnail: undefined, }; thumbnail = createSuccessfulRemoteDataObject(bitstream); });