diff --git a/src/app/features/preprints/mappers/preprints.mapper.ts b/src/app/features/preprints/mappers/preprints.mapper.ts index 51ead14da..61dd10329 100644 --- a/src/app/features/preprints/mappers/preprints.mapper.ts +++ b/src/app/features/preprints/mappers/preprints.mapper.ts @@ -1,4 +1,5 @@ import { StringOrNull } from '@osf/shared/helpers/types.helper'; +import { ContributorsMapper } from '@osf/shared/mappers/contributors'; import { IdentifiersMapper } from '@osf/shared/mappers/identifiers.mapper'; import { LicensesMapper } from '@osf/shared/mappers/licenses.mapper'; import { ApiData, JsonApiResponseWithMeta, ResponseJsonApi } from '@osf/shared/models/common/json-api.model'; @@ -170,20 +171,13 @@ export class PreprintsMapper { > ): PreprintShortInfoWithTotalCount { return { - data: response.data.map((preprintData) => { - return { - id: preprintData.id, - title: replaceBadEncodedChars(preprintData.attributes.title), - dateModified: preprintData.attributes.date_modified, - contributors: preprintData.embeds.bibliographic_contributors.data.map((contrData) => { - return { - id: contrData.id, - name: contrData.embeds.users.data.attributes.full_name, - }; - }), - providerId: preprintData.relationships.provider.data.id, - }; - }), + data: response.data.map((preprintData) => ({ + id: preprintData.id, + title: replaceBadEncodedChars(preprintData.attributes.title), + dateModified: preprintData.attributes.date_modified, + contributors: ContributorsMapper.getContributors(preprintData.embeds?.bibliographic_contributors?.data), + providerId: preprintData.relationships.provider.data.id, + })), totalCount: response.meta.total, }; } diff --git a/src/app/features/preprints/models/preprint.models.ts b/src/app/features/preprints/models/preprint.models.ts index f4ad604b4..527c1a76d 100644 --- a/src/app/features/preprints/models/preprint.models.ts +++ b/src/app/features/preprints/models/preprint.models.ts @@ -1,6 +1,6 @@ import { UserPermissions } from '@osf/shared/enums/user-permissions.enum'; import { BooleanOrNull, StringOrNull } from '@osf/shared/helpers/types.helper'; -import { IdNameModel } from '@shared/models/common/id-name.model'; +import { ContributorModel } from '@osf/shared/models/contributors/contributor.model'; import { IdentifierModel } from '@shared/models/identifiers/identifier.model'; import { LicenseModel, LicenseOptions } from '@shared/models/license/license.model'; @@ -57,7 +57,7 @@ export interface PreprintShortInfo { id: string; title: string; dateModified: string; - contributors: IdNameModel[]; + contributors: ContributorModel[]; providerId: string; } diff --git a/src/app/features/preprints/pages/my-preprints/my-preprints.component.html b/src/app/features/preprints/pages/my-preprints/my-preprints.component.html index a5f24cdcf..3bb682bad 100644 --- a/src/app/features/preprints/pages/my-preprints/my-preprints.component.html +++ b/src/app/features/preprints/pages/my-preprints/my-preprints.component.html @@ -54,7 +54,7 @@
{{ 'common.labels.and' | translate }} {{ dataValue.length - limitValue }} {{ 'common.labels.more' | translate }}
+