Merge pull request '[angular-16-update-zenodo-api | DONE] : update zenodo community API and parsing' (#14) from angular-16-update-zenodo-api into angular-16
Reviewed-on: #14
This commit is contained in:
commit
0478fe5670
|
@ -16,7 +16,8 @@ export class ZenodoCommunitiesService {
|
||||||
//.map(res => <any> res.json())
|
//.map(res => <any> res.json())
|
||||||
.pipe(map(res => [this.parseZenodoCommunities(res['hits'].hits),res['hits'].total]));
|
.pipe(map(res => [this.parseZenodoCommunities(res['hits'].hits),res['hits'].total]));
|
||||||
}
|
}
|
||||||
getZenodoCommunityById(properties:EnvProperties, url: string) {
|
getZenodoCommunityById(properties:EnvProperties, id: string) {
|
||||||
|
let url = properties.zenodoCommunities + "/" + id;
|
||||||
return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)) : url)
|
return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)) : url)
|
||||||
//.map(res => <any> res.json())
|
//.map(res => <any> res.json())
|
||||||
.pipe(map(res => {
|
.pipe(map(res => {
|
||||||
|
@ -39,14 +40,14 @@ export class ZenodoCommunitiesService {
|
||||||
|
|
||||||
parseZenodoCommunity(resData:any):ZenodoCommunityInfo {
|
parseZenodoCommunity(resData:any):ZenodoCommunityInfo {
|
||||||
var result: ZenodoCommunityInfo = new ZenodoCommunityInfo();
|
var result: ZenodoCommunityInfo = new ZenodoCommunityInfo();
|
||||||
|
let metadata = resData["metadata"];
|
||||||
result['title'] = resData.title;
|
result['title'] = metadata.title;
|
||||||
result['id'] = resData.id;
|
result['id'] = resData.id;
|
||||||
result['description'] = resData.description;
|
result['description'] = metadata.description;
|
||||||
result['link'] = resData.links.html;
|
result['link'] = resData.links.self_html;
|
||||||
result['logoUrl'] = resData.logo_url;
|
result['logoUrl'] = resData.links.logo;
|
||||||
result['date'] = resData.updated;
|
result['date'] = resData.updated;
|
||||||
result['page'] = resData.page;
|
result['page'] = metadata.page;
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue