80369: Add thumbnail link to Item & Bitstream models

This commit is contained in:
Yura Bondarenko
2021-06-25 17:17:56 +02:00
parent 0d5fc8a1c0
commit acff2186b4
3 changed files with 15 additions and 2 deletions

View File

@@ -43,13 +43,14 @@ export class Bitstream extends DSpaceObject implements HALResource {
bundle: HALLink; bundle: HALLink;
format: HALLink; format: HALLink;
content: HALLink; content: HALLink;
thumbnail: HALLink;
}; };
/** /**
* The thumbnail for this Bitstream * The thumbnail for this Bitstream
* Needs to be resolved first, but isn't available as a {@link HALLink} yet * Will be undefined unless the thumbnail {@link HALLink} has been resolved.
* Use BitstreamDataService.getThumbnailFor(…) for now.
*/ */
@link(BITSTREAM, false, 'thumbnail')
thumbnail?: Observable<RemoteData<Bitstream>>; thumbnail?: Observable<RemoteData<Bitstream>>;
/** /**

View File

@@ -19,6 +19,8 @@ import { ITEM } from './item.resource-type';
import { ChildHALResource } from './child-hal-resource.model'; import { ChildHALResource } from './child-hal-resource.model';
import { Version } from './version.model'; import { Version } from './version.model';
import { VERSION } from './version.resource-type'; import { VERSION } from './version.resource-type';
import { BITSTREAM } from './bitstream.resource-type';
import { Bitstream } from './bitstream.model';
/** /**
* Class representing a DSpace Item * Class representing a DSpace Item
@@ -69,6 +71,7 @@ export class Item extends DSpaceObject implements ChildHALResource {
owningCollection: HALLink; owningCollection: HALLink;
templateItemOf: HALLink; templateItemOf: HALLink;
version: HALLink; version: HALLink;
thumbnail: HALLink;
self: HALLink; self: HALLink;
}; };
@@ -100,6 +103,13 @@ export class Item extends DSpaceObject implements ChildHALResource {
@link(RELATIONSHIP, true) @link(RELATIONSHIP, true)
relationships?: Observable<RemoteData<PaginatedList<Relationship>>>; relationships?: Observable<RemoteData<PaginatedList<Relationship>>>;
/**
* The thumbnail for this Item
* Will be undefined unless the thumbnail {@link HALLink} has been resolved.
*/
@link(BITSTREAM, false, 'thumbnail')
thumbnail?: Observable<RemoteData<Bitstream>>;
/** /**
* Method that returns as which type of object this object should be rendered * Method that returns as which type of object this object should be rendered
*/ */

View File

@@ -78,6 +78,7 @@ describe('ThumbnailComponent', () => {
bundle: { href: 'bundle.url' }, bundle: { href: 'bundle.url' },
format: { href: 'format.url' }, format: { href: 'format.url' },
content: { href: 'content.url' }, content: { href: 'content.url' },
thumbnail: undefined,
}; };
}); });
@@ -126,6 +127,7 @@ describe('ThumbnailComponent', () => {
bundle: { href: 'bundle.url' }, bundle: { href: 'bundle.url' },
format: { href: 'format.url' }, format: { href: 'format.url' },
content: { href: 'content.url' }, content: { href: 'content.url' },
thumbnail: undefined,
}; };
thumbnail = createSuccessfulRemoteDataObject(bitstream); thumbnail = createSuccessfulRemoteDataObject(bitstream);
}); });