65272: TemplateItem object and normalized version

This commit is contained in:
Kristof De Langhe
2020-01-23 15:14:25 +01:00
parent 4f048f59f7
commit 24fc3e6c76
3 changed files with 43 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
import { inheritSerialization, deserialize } from 'cerialize';
import { mapsTo, relationship } from '../builders/build-decorators';
import { TemplateItem } from '../../shared/template-item.model';
import { NormalizedItem } from './normalized-item.model';
import { Collection } from '../../shared/collection.model';
/**
* Normalized model class for a DSpace Template Item
*/
@mapsTo(TemplateItem)
@inheritSerialization(NormalizedItem)
export class NormalizedTemplateItem extends NormalizedItem {
/**
* The Collection that this item is a template for
*/
@deserialize
@relationship(Collection, false)
templateItemOf: string;
}

View File

@@ -141,6 +141,7 @@ import { NormalizedExternalSource } from './cache/models/normalized-external-sou
import { NormalizedExternalSourceEntry } from './cache/models/normalized-external-source-entry.model';
import { ExternalSourceService } from './data/external-source.service';
import { LookupRelationService } from './data/lookup-relation.service';
import { NormalizedTemplateItem } from './cache/models/normalized-template-item.model';
/**
* When not in production, endpoint responses can be mocked for testing purposes
@@ -302,7 +303,8 @@ export const normalizedModels =
NormalizedRelationshipType,
NormalizedItemType,
NormalizedExternalSource,
NormalizedExternalSourceEntry
NormalizedExternalSourceEntry,
NormalizedTemplateItem
];
@NgModule({

View File

@@ -0,0 +1,18 @@
import { Item } from './item.model';
import { Observable } from 'rxjs/internal/Observable';
import { RemoteData } from '../data/remote-data';
import { Collection } from './collection.model';
import { ResourceType } from './resource-type';
/**
* Class representing a DSpace Template Item
*/
export class TemplateItem extends Item {
static type = new ResourceType('templateItem');
/**
* The Collection that this item is a template for
*/
templateItemOf: Observable<RemoteData<Collection>>;
}