diff --git a/src/app/core/provide-core.ts b/src/app/core/provide-core.ts index 2b83615c0c1..41b95b36212 100644 --- a/src/app/core/provide-core.ts +++ b/src/app/core/provide-core.ts @@ -4,6 +4,7 @@ import { makeEnvironmentProviders, } from '@angular/core'; import { APP_CONFIG } from '@dspace/config/app-config.interface'; +import { Identifier } from '@dspace/core/shared/identifiers-data/identifier.model'; import { SubmissionCustomUrl } from '@dspace/core/submission/models/submission-custom-url.model'; import { Audit } from './audit/model/audit.model'; @@ -199,6 +200,7 @@ export const models = ResearcherProfile, OrcidQueue, OrcidHistory, + Identifier, IdentifierData, Subscription, ItemRequest, diff --git a/src/app/core/shared/identifiers-data/identifier.model.ts b/src/app/core/shared/identifiers-data/identifier.model.ts index f528824b36f..2fa870d9f19 100644 --- a/src/app/core/shared/identifiers-data/identifier.model.ts +++ b/src/app/core/shared/identifiers-data/identifier.model.ts @@ -1,3 +1,5 @@ +import { typedObject } from '@dspace/core/cache/builders/build-decorators'; +import { IDENTIFIER } from '@dspace/core/shared/identifiers-data/identifier.resource-type'; import { autoserialize } from 'cerialize'; /** @@ -5,14 +7,22 @@ import { autoserialize } from 'cerialize'; * * @author Kim Shepherd */ +@typedObject export class Identifier { + static type = IDENTIFIER; + + /** + * Unique ID for this identifier object + */ + @autoserialize + id: string; /** * The value of the identifier, eg. http://hdl.handle.net/123456789/123 or https://doi.org/test/doi/1234 */ @autoserialize value: string; /** - * The type of identiifer, eg. "doi", or "handle", or "other" + * The type of identifier, eg. "doi", or "handle", or "other" */ @autoserialize identifierType: string; diff --git a/src/app/core/shared/identifiers-data/identifier.resource-type.ts b/src/app/core/shared/identifiers-data/identifier.resource-type.ts new file mode 100644 index 00000000000..585dad7fe43 --- /dev/null +++ b/src/app/core/shared/identifiers-data/identifier.resource-type.ts @@ -0,0 +1,9 @@ +import { ResourceType } from '@dspace/core/shared/resource-type'; + +/** + * The resource type for Identifier + * + * Needs to be in a separate file to prevent circular + * dependencies in webpack. + */ +export const IDENTIFIER = new ResourceType('identifier'); diff --git a/src/app/submission/sections/identifiers/section-identifiers.component.spec.ts b/src/app/submission/sections/identifiers/section-identifiers.component.spec.ts index c6b3600ab53..b73c7861b2a 100644 --- a/src/app/submission/sections/identifiers/section-identifiers.component.spec.ts +++ b/src/app/submission/sections/identifiers/section-identifiers.component.spec.ts @@ -88,12 +88,14 @@ const mockItem = Object.assign(new Item(), { // Mock identifier data to use with tests const identifierData: WorkspaceitemSectionIdentifiersObject = { identifiers: [{ + id: 'https://doi.org/10.33515/dspace-61', value: 'https://doi.org/10.33515/dspace-61', identifierType: 'doi', identifierStatus: 'TO_BE_REGISTERED', type: 'identifier', }, { + id: '123456789/418', value: '123456789/418', identifierType: 'handle', identifierStatus: null,