2021-11-12 11:36:16 +01:00
|
|
|
import {StringUtils} from "../../utils/string-utils.class";
|
2023-03-09 15:07:39 +01:00
|
|
|
import {SelectionCriteria} from "../../utils/entities/contentProvider";
|
2021-11-12 11:36:16 +01:00
|
|
|
|
2018-03-07 12:08:03 +01:00
|
|
|
export class CommunityInfo {
|
|
|
|
title: string;
|
|
|
|
shortTitle:string;
|
|
|
|
communityId: string;
|
|
|
|
queryId: string;
|
2018-03-26 16:13:28 +02:00
|
|
|
type: string;
|
2021-11-12 13:07:55 +01:00
|
|
|
/** @warning Use pipe in HTML or StringUtils.getLogoUrl in components */
|
2018-03-07 12:08:03 +01:00
|
|
|
logoUrl: string;
|
|
|
|
description: string;
|
|
|
|
managers: string[];
|
|
|
|
date:Date;
|
|
|
|
subjects: string[];
|
2023-07-18 13:26:12 +02:00
|
|
|
status:"all" | "manager" | "hidden" | "PUBLIC" | "RESTRICTED" | "PRIVATE";
|
2023-07-19 13:25:23 +02:00
|
|
|
claim: "all" | "managersOnly" | "membersOnly";
|
|
|
|
membership: "open" | "byInvitation";
|
2018-11-21 10:34:39 +01:00
|
|
|
zenodoCommunity:string;
|
2023-07-14 10:40:38 +02:00
|
|
|
otherZenodoCommunities: string[];
|
2021-02-16 11:25:23 +01:00
|
|
|
isUpload: boolean;
|
2019-04-13 20:26:46 +02:00
|
|
|
isSubscribed: boolean;
|
|
|
|
isManager: boolean;
|
2023-03-09 15:07:39 +01:00
|
|
|
fos: string[] = [];
|
|
|
|
sdg: string[] = []
|
|
|
|
selectionCriteria: SelectionCriteria;
|
2024-02-22 10:09:20 +01:00
|
|
|
plan: "starter" | "extended";
|
|
|
|
|
2021-11-12 11:36:16 +01:00
|
|
|
public static checkIsUpload(response: CommunityInfo | CommunityInfo[]): any | any[] {
|
|
|
|
if (Array.isArray(response)) {
|
|
|
|
response.forEach(value => {
|
|
|
|
value.isUpload = value.logoUrl && !StringUtils.isValidUrl(value.logoUrl);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
response.isUpload = response.logoUrl && !StringUtils.isValidUrl(response.logoUrl);
|
|
|
|
}
|
|
|
|
return response;
|
|
|
|
}
|
2023-10-10 11:25:03 +02:00
|
|
|
|
|
|
|
public isOpen() {
|
|
|
|
return !(this.membership && this.membership === 'byInvitation');
|
|
|
|
}
|
|
|
|
|
2023-07-18 13:26:12 +02:00
|
|
|
public isPublic(){
|
|
|
|
return this.status == "all" || this.status == "PUBLIC";
|
|
|
|
}
|
|
|
|
public isRestricted(){
|
|
|
|
return this.status == "manager" || this.status == "RESTRICTED";
|
|
|
|
}
|
|
|
|
public isPrivate(){
|
|
|
|
return this.status == "hidden" || this.status == "PRIVATE";
|
|
|
|
}
|
2023-07-19 11:57:28 +02:00
|
|
|
public validateStatus(){
|
|
|
|
if(!(this.isPrivate() || this.isRestricted() || this.isPublic())){
|
|
|
|
this.status = "PRIVATE";
|
|
|
|
}
|
|
|
|
}
|
2018-03-07 12:08:03 +01:00
|
|
|
}
|
2020-11-30 17:55:28 +01:00
|
|
|
// export const prodReadyCommunities = ["dh-ch", "ee", "fam", "mes", "ni", "covid-19", "dariah", "epos", "egi"];
|