apply initial changes to library bases on new community API

This commit is contained in:
argirok 2023-07-14 11:40:38 +03:00
parent 5645deec97
commit 3ee4129c7e
5 changed files with 7 additions and 7 deletions

View File

@ -100,6 +100,7 @@ export class CommunityService {
community.zenodoCommunity = resData.zenodoCommunity; community.zenodoCommunity = resData.zenodoCommunity;
community.status = 'all'; community.status = 'all';
community.type = resData.type; community.type = resData.type;
community.otherZenodoCommunities = resData.otherZenodoCommunities;
if (resData.hasOwnProperty('status')) { if (resData.hasOwnProperty('status')) {
community.status = resData.status; community.status = resData.status;
const status = ['all', 'hidden', 'manager']; const status = ['all', 'hidden', 'manager'];

View File

@ -16,6 +16,7 @@ export class CommunityInfo {
subjects: string[]; subjects: string[];
status:string; status:string;
zenodoCommunity:string; zenodoCommunity:string;
otherZenodoCommunities: string[];
isUpload: boolean; isUpload: boolean;
isSubscribed: boolean; isSubscribed: boolean;
isManager: boolean; isManager: boolean;

View File

@ -7,15 +7,15 @@ import {map} from "rxjs/operators";
export class SearchCommunityProjectsService { export class SearchCommunityProjectsService {
constructor(private http: HttpClient ) {} constructor(private http: HttpClient ) {}
searchProjects (properties:EnvProperties, pid: string):any { searchProjects (properties:EnvProperties, pid: string, page=0, size=100):any {
let url = properties.communityAPI+pid+"/projects"; let url = properties.communityAPI+pid+"/projects/"+ page + "/" + size;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url); return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
//.map(res => <any> res.json()) //.map(res => <any> res.json())
} }
countTotalProjects(properties:EnvProperties,pid:string) { countTotalProjects(properties:EnvProperties,pid:string) {
let url = properties.communityAPI+pid+"/projects"; let url = properties.communityAPI+pid+"/projects/0/0";
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
.pipe(map(res => res['length'])); .pipe(map(res => res['totalElements']));
} }
} }

View File

@ -16,12 +16,11 @@ 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, openaireId:string) { getZenodoCommunityById(properties:EnvProperties, url: string) {
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 => {
var community = this.parseZenodoCommunity(res); var community = this.parseZenodoCommunity(res);
community["openaireId"]=openaireId;
return community; return community;
})); }));
} }

View File

@ -6,5 +6,4 @@ export class ZenodoCommunityInfo {
logoUrl: string; logoUrl: string;
date: Date; date: Date;
page: string; page: string;
openaireId:string;
} }