@@ -27,6 +27,7 @@ export class MetadataMapper {
2727 value : identifier . attributes . value ,
2828 } ) ) ,
2929 provider : response . embeds ?. provider ?. data . id ,
30+ public : response . attributes . public ,
3031 } ;
3132 }
3233
@@ -65,55 +66,4 @@ export class MetadataMapper {
6566 } ,
6667 } ;
6768 }
68-
69- // static fromMetadataApiResponse(response: Record<string, unknown>): ProjectOverview {
70- // const attributes = response['attributes'] as Record<string, unknown>;
71- // const embeds = response['embeds'] as Record<string, unknown>;
72-
73- // const contributors: ProjectOverviewContributor[] = [];
74- // if (embeds['contributors']) {
75- // const contributorsData = (embeds['contributors'] as Record<string, unknown>)['data'] as Record<string, unknown>[];
76- // contributorsData?.forEach((contributor) => {
77- // const contributorEmbeds = contributor['embeds'] as Record<string, unknown>;
78- // const userData = (contributorEmbeds['users'] as Record<string, unknown>)['data'] as Record<string, unknown>;
79- // const userAttributes = userData['attributes'] as Record<string, unknown>;
80-
81- // contributors.push({
82- // id: userData['id'] as string,
83- // type: userData['type'] as string,
84- // fullName: userAttributes['full_name'] as string,
85- // givenName: userAttributes['given_name'] as string,
86- // familyName: userAttributes['family_name'] as string,
87- // middleName: '',
88- // });
89- // });
90- // }
91-
92- // return {
93- // id: response['id'] as string,
94- // type: (response['type'] as string) || 'nodes',
95- // title: attributes['title'] as string,
96- // description: attributes['description'] as string,
97- // category: attributes['category'] as string,
98- // tags: (attributes['tags'] as string[]) || [],
99- // dateCreated: attributes['date_created'] as string,
100- // dateModified: attributes['date_modified'] as string,
101- // isPublic: attributes['public'] as boolean,
102- // isRegistration: attributes['registration'] as boolean,
103- // isPreprint: attributes['preprint'] as boolean,
104- // isFork: attributes['fork'] as boolean,
105- // isCollection: attributes['collection'] as boolean,
106- // accessRequestsEnabled: attributes['access_requests_enabled'] as boolean,
107- // wikiEnabled: attributes['wiki_enabled'] as boolean,
108- // currentUserCanComment: attributes['current_user_can_comment'] as boolean,
109- // currentUserPermissions: (attributes['current_user_permissions'] as string[]) || [],
110- // currentUserIsContributor: attributes['current_user_is_contributor'] as boolean,
111- // currentUserIsContributorOrGroupMember: attributes['current_user_is_contributor_or_group_member'] as boolean,
112- // analyticsKey: '',
113- // contributors: contributors,
114- // subjects: Array.isArray(attributes['subjects']) ? attributes['subjects'].flat() : attributes['subjects'],
115- // forksCount: 0,
116- // viewOnlyLinksCount: 0,
117- // } as ProjectOverview;
118- // }
11969}
0 commit comments