diff --git a/src/app/features/registry/components/registry-revisions/registry-revisions.component.ts b/src/app/features/registry/components/registry-revisions/registry-revisions.component.ts index 46b9930d4..52f1d27f0 100644 --- a/src/app/features/registry/components/registry-revisions/registry-revisions.component.ts +++ b/src/app/features/registry/components/registry-revisions/registry-revisions.component.ts @@ -35,10 +35,12 @@ export class RegistryRevisionsComponent { revisions = computed(() => { let schemaResponses = this.registry()?.schemaResponses || []; + if (this.registryAcceptedUnapproved) { this.unApprovedRevisionId = schemaResponses.find((response) => response.reviewsState === RevisionReviewStates.Unapproved)?.id || null; } + schemaResponses = this.isModeration() ? schemaResponses : schemaResponses.filter((r) => r.reviewsState === RevisionReviewStates.Approved); diff --git a/src/app/features/registry/components/registry-statuses/registry-statuses.component.html b/src/app/features/registry/components/registry-statuses/registry-statuses.component.html index 2e43324b4..f3a044be6 100644 --- a/src/app/features/registry/components/registry-statuses/registry-statuses.component.html +++ b/src/app/features/registry/components/registry-statuses/registry-statuses.component.html @@ -7,11 +7,21 @@

{{ 'registry.overview.statuses.' + registry()?.status + '.short' | translate }}

-

- {{ - 'registry.overview.statuses.' + registry()?.status + '.long' | translate: { embargoEndDate: embargoEndDate } - }} -

+
+

+ {{ + 'registry.overview.statuses.' + registry()?.status + '.long' + | translate: { embargoEndDate: embargoEndDate } + }} +

+ + @if (isAccepted()) { + + {{ 'registry.overview.statuses.accepted.project' | translate }}. + } +
+ @if (canEdit()) { @if (canWithdraw()) { {{ 'registry.overview.statuses.' + registry()?.status + styleClass="w-full mt-2" > } + @if (isEmbargo()) { { - return this.registry()?.reviewsState === RegistrationReviewStates.Accepted && !this.isModeration(); - }); + canWithdraw = computed( + () => this.registry()?.reviewsState === RegistrationReviewStates.Accepted && !this.isModeration() + ); - isEmbargo = computed(() => { - return this.registry()?.status === RegistryStatus.Embargo; - }); + isAccepted = computed(() => this.registry()?.reviewsState === RegistrationReviewStates.Accepted); + isEmbargo = computed(() => this.registry()?.status === RegistryStatus.Embargo); get embargoEndDate() { const embargoEndDate = this.registry()?.embargoEndDate; diff --git a/src/app/features/registry/mappers/registry-overview.mapper.ts b/src/app/features/registry/mappers/registry-overview.mapper.ts index 9a96af977..079ed0567 100644 --- a/src/app/features/registry/mappers/registry-overview.mapper.ts +++ b/src/app/features/registry/mappers/registry-overview.mapper.ts @@ -1,6 +1,7 @@ -import { RegistryOverview, RegistryOverviewJsonApiData } from '@osf/features/registry/models'; -import { MapRegistryStatus, ReviewPermissionsMapper } from '@osf/shared/mappers'; -import { RegistrationMapper } from '@osf/shared/mappers/registration'; +import { IdentifiersMapper, LicensesMapper } from '@osf/shared/mappers'; +import { MapRegistryStatus, RegistrationMapper, RegistrationNodeMapper } from '@osf/shared/mappers/registration'; + +import { RegistryOverview, RegistryOverviewJsonApiData } from '../models'; export function MapRegistryOverview(data: RegistryOverviewJsonApiData): RegistryOverview | null { return { @@ -16,16 +17,15 @@ export function MapRegistryOverview(data: RegistryOverviewJsonApiData): Registry category: data.attributes?.category, customCitation: data.attributes?.custom_citation, isFork: data.attributes?.fork, - accessRequestsEnabled: data.attributes?.accessRequestsEnabled, + accessRequestsEnabled: data.attributes?.access_requests_enabled, nodeLicense: data.attributes.node_license ? { copyrightHolders: data.attributes.node_license.copyright_holders, year: data.attributes.node_license.year, } : undefined, - license: data.embeds?.license?.data?.attributes, registrationType: data.attributes?.registration_supplement, - doi: data.attributes?.doi, + doi: data.attributes?.article_doi, tags: data.attributes?.tags, contributors: data.embeds?.bibliographic_contributors?.data.map((contributor) => ({ id: contributor?.embeds?.users?.data?.id, @@ -35,42 +35,29 @@ export function MapRegistryOverview(data: RegistryOverviewJsonApiData): Registry middleName: contributor?.embeds?.users?.data?.attributes?.middle_names, type: contributor?.embeds?.users?.data?.type, })), - identifiers: data.embeds?.identifiers?.data.map((identifier) => ({ - id: identifier.id, - type: identifier.type, - value: identifier.attributes.value, - category: identifier.attributes.category, - })), - analyticsKey: data.attributes?.analyticsKey, + identifiers: IdentifiersMapper.fromJsonApi(data.embeds.identifiers), + analyticsKey: data.attributes?.analytics_key, currentUserCanComment: data.attributes.current_user_can_comment, currentUserPermissions: data.attributes.current_user_permissions, currentUserIsContributor: data.attributes.current_user_is_contributor, currentUserIsContributorOrGroupMember: data.attributes.current_user_is_contributor_or_group_member, citation: data.relationships?.citation?.data?.id, - wikiEnabled: data.attributes.wikiEnabled, + wikiEnabled: data.attributes.wiki_enabled, region: data.relationships.region?.data, hasData: data.attributes.has_data, hasAnalyticCode: data.attributes.has_analytic_code, hasMaterials: data.attributes.has_materials, hasPapers: data.attributes.has_papers, hasSupplements: data.attributes.has_supplements, - questions: data.attributes.registration_responses, + license: LicensesMapper.fromLicenseDataJsonApi(data.embeds.license.data), registrationSchemaLink: data.relationships.registration_schema.links.related.href, associatedProjectId: data.relationships?.registered_from?.data?.id, schemaResponses: data.embeds?.schema_responses?.data?.map((item) => RegistrationMapper.fromSchemaResponse(item)), - provider: { - id: data.embeds?.provider.data.id, - name: data.embeds?.provider.data.attributes.name, - permissions: data.embeds?.provider.data.attributes.permissions, - }, + provider: RegistrationNodeMapper.getRegistrationProviderShortInfo(data.embeds.provider.data), status: MapRegistryStatus(data.attributes), revisionStatus: data.attributes.revision_state, reviewsState: data.attributes.reviews_state, - links: { - files: data?.embeds?.files?.data?.[0]?.relationships?.files?.links?.related?.href, - }, archiving: data.attributes.archiving, - currentUserIsModerator: ReviewPermissionsMapper.fromProviderResponse(data.embeds?.provider.data), withdrawn: data.attributes.withdrawn || false, withdrawalJustification: data.attributes.withdrawal_justification, dateWithdrawn: data.attributes.date_withdrawn || null, @@ -78,3 +65,17 @@ export function MapRegistryOverview(data: RegistryOverviewJsonApiData): Registry rootParentId: data.relationships.root?.data?.id, } as RegistryOverview; } + +export function MapRegistrationOverview(data: RegistryOverviewJsonApiData) { + const registrationAttributes = RegistrationNodeMapper.getRegistrationNodeAttributes(data.id, data.attributes); + const providerInfo = RegistrationNodeMapper.getRegistrationProviderShortInfo(data.embeds.provider.data); + const identifiers = IdentifiersMapper.fromJsonApi(data.embeds.identifiers); + const license = LicensesMapper.fromLicenseDataJsonApi(data.embeds.license.data); + + return { + ...registrationAttributes, + provider: providerInfo, + identifiers: identifiers, + license: license, + }; +} diff --git a/src/app/features/registry/models/get-registry-overview-json-api.model.ts b/src/app/features/registry/models/get-registry-overview-json-api.model.ts index 6fcafb139..83d678a18 100644 --- a/src/app/features/registry/models/get-registry-overview-json-api.model.ts +++ b/src/app/features/registry/models/get-registry-overview-json-api.model.ts @@ -1,9 +1,13 @@ import { RegistrationReviewStates, RevisionReviewStates } from '@osf/shared/enums'; import { ApiData, + IdentifiersJsonApiData, JsonApiResponseWithMeta, + LicenseDataJsonApi, MetaAnonymousJsonApi, - ProviderDataJsonApi, + RegistrationNodeAttributesJsonApi, + RegistryProviderDetailsJsonApi, + ResponseJsonApi, SchemaResponseDataJsonApi, } from '@osf/shared/models'; @@ -14,7 +18,7 @@ export type GetRegistryOverviewJsonApi = JsonApiResponseWithMeta< >; export type RegistryOverviewJsonApiData = ApiData< - RegistryOverviewJsonApiAttributes, + RegistrationNodeAttributesJsonApi, RegistryOverviewJsonApiEmbed, RegistryOverviewJsonApiRelationships, null @@ -87,26 +91,9 @@ export interface RegistryOverviewJsonApiEmbed { }[]; }; license: { - data: { - id: string; - type: string; - attributes: { - name: string; - text: string; - url: string; - }; - }; - }; - identifiers: { - data: { - id: string; - type: string; - attributes: { - category: string; - value: string; - }; - }[]; + data: LicenseDataJsonApi; }; + identifiers: ResponseJsonApi; schema_responses: { data: SchemaResponseDataJsonApi[]; }; @@ -124,7 +111,7 @@ export interface RegistryOverviewJsonApiEmbed { }; }[]; }; - provider: { data: ProviderDataJsonApi }; + provider: { data: RegistryProviderDetailsJsonApi }; } export interface RegistryOverviewJsonApiRelationships { diff --git a/src/app/features/registry/models/registry-overview.models.ts b/src/app/features/registry/models/registry-overview.models.ts index 252734ce5..c50fc2835 100644 --- a/src/app/features/registry/models/registry-overview.models.ts +++ b/src/app/features/registry/models/registry-overview.models.ts @@ -1,11 +1,13 @@ import { ProjectOverviewContributor } from '@osf/features/project/overview/models'; -import { RegistrationQuestions } from '@osf/features/registry/models'; import { + Identifier, IdTypeModel, LicenseModel, LicensesOption, MetaAnonymousJsonApi, ProviderShortInfoModel, + RegistrationNodeModel, + RegistrationResponses, SchemaResponse, SubjectModel, } from '@osf/shared/models'; @@ -33,12 +35,7 @@ export interface RegistryOverview { nodeLicense?: LicensesOption; license?: LicenseModel; licenseUrl?: string; - identifiers?: { - id: string; - type: string; - category: string; - value: string; - }[]; + identifiers?: Identifier[]; analyticsKey: string; currentUserCanComment: boolean; currentUserPermissions: UserPermissions[]; @@ -53,25 +50,34 @@ export interface RegistryOverview { hasMaterials: boolean; hasPapers: boolean; hasSupplements: boolean; - questions: RegistrationQuestions; + questions: RegistrationResponses; registrationSchemaLink: string; associatedProjectId: string; schemaResponses: SchemaResponse[]; status: RegistryStatus; revisionStatus: RevisionReviewStates; reviewsState?: RegistrationReviewStates; - links: { - files: string; - }; archiving: boolean; embargoEndDate: string; - currentUserIsModerator: boolean; withdrawn: boolean; withdrawalJustification?: string; dateWithdrawn: string | null; rootParentId: string | null; } +export interface RegistrationOverviewModel extends RegistrationNodeModel { + type: string; + registrationSchemaLink: string; + associatedProjectId: string; + citation: string; + provider?: ProviderShortInfoModel; + contributors: ProjectOverviewContributor[]; + license?: LicenseModel; + identifiers?: Identifier[]; + schemaResponses: SchemaResponse[]; + status: RegistryStatus; +} + export interface RegistryOverviewWithMeta { registry: RegistryOverview | null; meta?: MetaAnonymousJsonApi; diff --git a/src/app/features/registry/pages/registry-overview/registry-overview.component.ts b/src/app/features/registry/pages/registry-overview/registry-overview.component.ts index bfe6e1654..91ecceea7 100644 --- a/src/app/features/registry/pages/registry-overview/registry-overview.component.ts +++ b/src/app/features/registry/pages/registry-overview/registry-overview.component.ts @@ -109,9 +109,7 @@ export class RegistryOverviewComponent { this.areSubjectsLoading() ); - canMakeDecision = computed(() => { - return !this.registry()?.archiving && !this.registry()?.withdrawn && this.isModeration; - }); + canMakeDecision = computed(() => !this.registry()?.archiving && !this.registry()?.withdrawn && this.isModeration); isRootRegistration = computed(() => { const rootId = this.registry()?.rootParentId; diff --git a/src/app/features/registry/store/registry-overview/registry-overview.actions.ts b/src/app/features/registry/store/registry-overview/registry-overview.actions.ts index 57b70e0f8..782242af0 100644 --- a/src/app/features/registry/store/registry-overview/registry-overview.actions.ts +++ b/src/app/features/registry/store/registry-overview/registry-overview.actions.ts @@ -1,4 +1,3 @@ -import { RegistrationQuestions } from '@osf/shared/models'; import { ReviewActionPayload } from '@osf/shared/models/review-action'; export class GetRegistryById { @@ -16,10 +15,7 @@ export class GetRegistryInstitutions { export class GetSchemaBlocks { static readonly type = '[Registry Overview] Get Schema Blocks'; - constructor( - public schemaLink: string, - public questions: RegistrationQuestions - ) {} + constructor(public schemaLink: string) {} } export class WithdrawRegistration { diff --git a/src/app/features/registry/store/registry-overview/registry-overview.state.ts b/src/app/features/registry/store/registry-overview/registry-overview.state.ts index 91a66cd5b..dc9e48d1e 100644 --- a/src/app/features/registry/store/registry-overview/registry-overview.state.ts +++ b/src/app/features/registry/store/registry-overview/registry-overview.state.ts @@ -66,8 +66,8 @@ export class RegistryOverviewState { isAnonymous: response.meta?.anonymous ?? false, }); - if (registryOverview?.registrationSchemaLink && registryOverview?.questions) { - ctx.dispatch(new GetSchemaBlocks(registryOverview.registrationSchemaLink, registryOverview.questions)); + if (registryOverview?.registrationSchemaLink) { + ctx.dispatch(new GetSchemaBlocks(registryOverview.registrationSchemaLink)); } }), catchError((error) => handleSectionError(ctx, 'registry', error)) @@ -142,8 +142,8 @@ export class RegistryOverviewState { }, }); - if (registryOverview?.registrationSchemaLink && registryOverview?.questions) { - ctx.dispatch(new GetSchemaBlocks(registryOverview.registrationSchemaLink, registryOverview.questions)); + if (registryOverview?.registrationSchemaLink) { + ctx.dispatch(new GetSchemaBlocks(registryOverview.registrationSchemaLink)); } }), catchError((error) => handleSectionError(ctx, 'registry', error)) @@ -169,8 +169,9 @@ export class RegistryOverviewState { error: null, }, }); - if (registryOverview?.registrationSchemaLink && registryOverview?.questions) { - ctx.dispatch(new GetSchemaBlocks(registryOverview.registrationSchemaLink, registryOverview.questions)); + + if (registryOverview?.registrationSchemaLink) { + ctx.dispatch(new GetSchemaBlocks(registryOverview.registrationSchemaLink)); } }), catchError((error) => handleSectionError(ctx, 'registry', error)) diff --git a/src/app/shared/mappers/index.ts b/src/app/shared/mappers/index.ts index 5579fbd32..81457cd0f 100644 --- a/src/app/shared/mappers/index.ts +++ b/src/app/shared/mappers/index.ts @@ -9,15 +9,14 @@ export * from './emails.mapper'; export * from './files/files.mapper'; export * from './filters/filter-option.mapper'; export * from './filters/reusable-filter.mapper'; +export * from './identifiers.mapper'; export * from './institutions'; export * from './licenses.mapper'; export * from './nodes'; export * from './notification-subscription.mapper'; export * from './registration-provider.mapper'; -export * from './registry'; export * from './resource-overview.mappers'; export * from './review-actions.mapper'; -export * from './review-permissions.mapper'; export * from './subjects'; export * from './user'; export * from './user-related-counts'; diff --git a/src/app/shared/mappers/registration/index.ts b/src/app/shared/mappers/registration/index.ts index a6edc914e..02673bffd 100644 --- a/src/app/shared/mappers/registration/index.ts +++ b/src/app/shared/mappers/registration/index.ts @@ -1,2 +1,4 @@ +export * from './map-registry-status.mapper'; export * from './page-schema.mapper'; export * from './registration.mapper'; +export * from './registration-node.mapper'; diff --git a/src/app/shared/mappers/registry/map-registry-status.mapper.ts b/src/app/shared/mappers/registration/map-registry-status.mapper.ts similarity index 100% rename from src/app/shared/mappers/registry/map-registry-status.mapper.ts rename to src/app/shared/mappers/registration/map-registry-status.mapper.ts diff --git a/src/app/shared/mappers/registration/registration-node.mapper.ts b/src/app/shared/mappers/registration/registration-node.mapper.ts new file mode 100644 index 000000000..f168986bc --- /dev/null +++ b/src/app/shared/mappers/registration/registration-node.mapper.ts @@ -0,0 +1,90 @@ +import { CurrentResourceType } from '@osf/shared/enums'; +import { + ProviderShortInfoModel, + RegistrationNodeAttributesJsonApi, + RegistrationNodeModel, + RegistrationResponses, + RegistrationResponsesJsonApi, + RegistryProviderDetailsJsonApi, +} from '@osf/shared/models'; + +export class RegistrationNodeMapper { + static getRegistrationNodeAttributes( + id: string, + attributes: RegistrationNodeAttributesJsonApi + ): RegistrationNodeModel { + return { + id, + accessRequestsEnabled: attributes.access_requests_enabled, + archiving: attributes.archiving, + articleDoi: attributes.article_doi, + category: attributes.category, + currentUserIsContributor: attributes.current_user_is_contributor, + currentUserPermissions: attributes.current_user_permissions || [], + customCitation: attributes.custom_citation, + dateCreated: attributes.date_created, + dateModified: attributes.date_modified, + dateRegistered: attributes.date_registered, + dateWithdrawn: attributes.date_withdrawn, + description: attributes.description, + embargoed: attributes.embargoed, + embargoEndDate: attributes.embargo_end_date, + hasAnalyticCode: attributes.has_analytic_code, + hasData: attributes.has_data, + hasMaterials: attributes.has_materials, + hasPapers: attributes.has_papers, + hasProject: attributes.has_project, + hasSupplements: attributes.has_supplements, + iaUrl: attributes.ia_url, + isCollection: attributes.collection, + isFork: attributes.fork, + isPreprint: attributes.preprint, + isPublic: attributes.public, + isRegistration: attributes.registration, + nodeLicense: { + copyrightHolders: attributes.node_license?.copyright_holders || null, + year: attributes.node_license?.year || null, + }, + pendingEmbargoApproval: attributes.pending_embargo_approval, + pendingEmbargoTerminationApproval: attributes.pending_embargo_termination_approval, + pendingRegistrationApproval: attributes.pending_registration_approval, + pendingWithdrawal: attributes.pending_withdrawal, + providerSpecificMetadata: attributes.provider_specific_metadata, + registeredMeta: attributes.registered_meta, + registrationResponses: this.getRegistrationResponses(attributes.registration_responses), + registrationSupplement: attributes.registration_supplement, + reviewsState: attributes.reviews_state, + revisionState: attributes.revision_state, + tags: attributes.tags || [], + title: attributes.title, + wikiEnabled: attributes.wiki_enabled, + withdrawalJustification: attributes.withdrawal_justification, + withdrawn: attributes.withdrawn, + }; + } + + static getRegistrationResponses(response: RegistrationResponsesJsonApi): RegistrationResponses { + return { + summary: response.summary, + uploader: response.uploader.map((uploadItem) => ({ + fileId: uploadItem.file_id, + fileName: uploadItem.file_name, + fileUrls: uploadItem.file_urls, + fileHashes: uploadItem.file_hashes, + })), + }; + } + + static getRegistrationProviderShortInfo(provider?: RegistryProviderDetailsJsonApi): ProviderShortInfoModel { + if (!provider) { + return {} as ProviderShortInfoModel; + } + + return { + id: provider.id, + name: provider.attributes.name, + permissions: provider.attributes.permissions, + type: CurrentResourceType.Registrations, + }; + } +} diff --git a/src/app/shared/mappers/registration/registration.mapper.ts b/src/app/shared/mappers/registration/registration.mapper.ts index 923e22363..916022d8c 100644 --- a/src/app/shared/mappers/registration/registration.mapper.ts +++ b/src/app/shared/mappers/registration/registration.mapper.ts @@ -9,7 +9,7 @@ import { SchemaResponseDataJsonApi, } from '@osf/shared/models'; -import { MapRegistryStatus } from '../registry'; +import { MapRegistryStatus } from './map-registry-status.mapper'; export class RegistrationMapper { static fromDraftRegistrationResponse(response: DraftRegistrationDataJsonApi): DraftRegistrationModel { diff --git a/src/app/shared/mappers/registry/index.ts b/src/app/shared/mappers/registry/index.ts deleted file mode 100644 index b4034dc67..000000000 --- a/src/app/shared/mappers/registry/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './map-registry-status.mapper'; diff --git a/src/app/shared/mappers/review-permissions.mapper.ts b/src/app/shared/mappers/review-permissions.mapper.ts deleted file mode 100644 index 1cbe40b4c..000000000 --- a/src/app/shared/mappers/review-permissions.mapper.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ReviewPermissions } from '../enums'; -import { ProviderDataJsonApi } from '../models'; - -export class ReviewPermissionsMapper { - static fromProviderResponse(response: ProviderDataJsonApi): boolean { - return response.attributes?.permissions?.includes(ReviewPermissions.ViewSubmissions) || false; - } -} diff --git a/src/app/shared/models/nodes/base-node-attributes-json-api.model.ts b/src/app/shared/models/nodes/base-node-attributes-json-api.model.ts index 6d3938865..0c7491853 100644 --- a/src/app/shared/models/nodes/base-node-attributes-json-api.model.ts +++ b/src/app/shared/models/nodes/base-node-attributes-json-api.model.ts @@ -1,26 +1,26 @@ import { UserPermissions } from '@osf/shared/enums'; export interface BaseNodeAttributesJsonApi { - title: string; - description: string; + access_requests_enabled: boolean; + analytics_key: string; category: string; + collection: boolean; + current_user_can_comment: boolean; + current_user_is_contributor: boolean; + current_user_is_contributor_or_group_member: boolean; + current_user_permissions: UserPermissions[]; custom_citation: string; date_created: string; date_modified: string; - registration: boolean; - preprint: boolean; + description: string; fork: boolean; - collection: boolean; - tags: string[]; - access_requests_enabled: boolean; node_license: NodeLicenseJsonApi | null; - analytics_key: string; - current_user_can_comment: boolean; - current_user_permissions: UserPermissions[]; - current_user_is_contributor: boolean; - current_user_is_contributor_or_group_member: boolean; - wiki_enabled: boolean; + preprint: boolean; public: boolean; + registration: boolean; + tags: string[]; + title: string; + wiki_enabled: boolean; } export interface NodeLicenseJsonApi { diff --git a/src/app/shared/models/registration/index.ts b/src/app/shared/models/registration/index.ts index b1c96ee15..26cb515b6 100644 --- a/src/app/shared/models/registration/index.ts +++ b/src/app/shared/models/registration/index.ts @@ -4,6 +4,7 @@ export * from './provider-schema.model'; export * from './registration.model'; export * from './registration-card.model'; export * from './registration-json-api.model'; +export * from './registration-node.model'; export * from './registration-node-json-api.model'; export * from './schema-blocks-json-api.model'; export * from './schema-response.model'; diff --git a/src/app/shared/models/registration/registration-node-json-api.model.ts b/src/app/shared/models/registration/registration-node-json-api.model.ts index d4796801d..f7f19b08d 100644 --- a/src/app/shared/models/registration/registration-node-json-api.model.ts +++ b/src/app/shared/models/registration/registration-node-json-api.model.ts @@ -21,8 +21,8 @@ export interface RegistrationNodeAttributesJsonApi extends BaseNodeAttributesJso pending_registration_approval: boolean; pending_withdrawal: boolean; provider_specific_metadata: string[]; - registered_meta: RegisteredMeta; - registration_responses: RegistrationResponses; + registered_meta: RegisteredMetaJsonApi; + registration_responses: RegistrationResponsesJsonApi; registration_supplement: string; reviews_state: RegistrationReviewStates; revision_state: RevisionReviewStates; @@ -30,7 +30,7 @@ export interface RegistrationNodeAttributesJsonApi extends BaseNodeAttributesJso withdrawn: boolean; } -export interface RegisteredMetaExtra { +export interface RegisteredMetaExtraJsonApi { data: { name: string }; nodeId: string; sha256: string; @@ -38,33 +38,33 @@ export interface RegisteredMetaExtra { selectedFileName: string; } -export interface RegisteredMetaField { - extra: RegisteredMetaExtra[]; +export interface RegisteredMetaFieldJsonApi { + extra: RegisteredMetaExtraJsonApi[]; value: string; } -export interface RegisteredMeta { +export interface RegisteredMetaJsonApi { summary: { extra: string[]; value: string }; - uploader: RegisteredMetaField; + uploader: RegisteredMetaFieldJsonApi; } -export interface FileUrls { +export interface FileUrlsJsonApi { html: string; download: string; } -export interface FileHashes { +export interface FileHashesJsonApi { sha256: string; } -export interface RegistrationUploader { +export interface RegistrationUploaderJsonApi { file_id: string; file_name: string; - file_urls: FileUrls; - file_hashes: FileHashes; + file_urls: FileUrlsJsonApi; + file_hashes: FileHashesJsonApi; } -export interface RegistrationResponses { +export interface RegistrationResponsesJsonApi { summary: string; - uploader: RegistrationUploader[]; + uploader: RegistrationUploaderJsonApi[]; } diff --git a/src/app/shared/models/registration/registration-node.model.ts b/src/app/shared/models/registration/registration-node.model.ts new file mode 100644 index 000000000..08f80bce3 --- /dev/null +++ b/src/app/shared/models/registration/registration-node.model.ts @@ -0,0 +1,70 @@ +import { RegistrationReviewStates, RevisionReviewStates } from '@osf/shared/enums'; + +import { BaseNodeModel } from '../nodes'; + +export interface RegistrationNodeModel extends BaseNodeModel { + archiving: boolean; + articleDoi: string; + dateRegistered: string; + dateWithdrawn: string | null; + embargoEndDate: string | null; + embargoed: boolean; + hasAnalyticCode: boolean; + hasData: boolean; + hasMaterials: boolean; + hasPapers: boolean; + hasProject: boolean; + hasSupplements: boolean; + iaUrl: string | null; + pendingEmbargoApproval: boolean; + pendingEmbargoTerminationApproval: boolean; + pendingRegistrationApproval: boolean; + pendingWithdrawal: boolean; + providerSpecificMetadata: string[]; + registeredMeta: RegisteredMeta; + registrationResponses: RegistrationResponses; + registrationSupplement: string; + reviewsState: RegistrationReviewStates; + revisionState: RevisionReviewStates; + withdrawalJustification: string | null; + withdrawn: boolean; +} + +export interface RegisteredMetaExtra { + data: { name: string }; + nodeId: string; + sha256: string; + viewUrl: string; + selectedFileName: string; +} + +export interface RegisteredMetaField { + extra: RegisteredMetaExtra[]; + value: string; +} + +export interface RegisteredMeta { + summary: { extra: string[]; value: string }; + uploader: RegisteredMetaField; +} + +export interface FileUrls { + html: string; + download: string; +} + +export interface FileHashes { + sha256: string; +} + +export interface RegistrationUploader { + fileId: string; + fileName: string; + fileUrls: FileUrls; + fileHashes: FileHashes; +} + +export interface RegistrationResponses { + summary: string; + uploader: RegistrationUploader[]; +} diff --git a/src/app/shared/models/resource-overview.model.ts b/src/app/shared/models/resource-overview.model.ts index 9e5b1c722..30fc7132c 100644 --- a/src/app/shared/models/resource-overview.model.ts +++ b/src/app/shared/models/resource-overview.model.ts @@ -1,6 +1,7 @@ import { ProjectOverviewContributor } from '@osf/features/project/overview/models'; import { IdTypeModel } from './common'; +import { Identifier } from './identifiers'; import { Institution } from './institutions'; import { LicensesOption } from './license.model'; import { SubjectModel } from './subject'; @@ -33,12 +34,7 @@ export interface ResourceOverview { storageLimitStatus: string; storageUsage: string; }; - identifiers?: { - id: string; - type: string; - category: string; - value: string; - }[]; + identifiers?: Identifier[]; supplements?: { id: string; type: string; diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 70b8385c4..5197e6a0d 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -2454,7 +2454,8 @@ "accepted": { "text": "Public registration", "short": "Public", - "long": "This public registration is a frozen, non-editable version of this." + "long": "This public registration is a frozen, non-editable version of this", + "project": "project" }, "embargo": { "text": "Embargoed registration",