mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 16:45:16 +00:00
Start to give advanced info about users
This commit is contained in:
@ -20,9 +20,19 @@ export interface UserBuilder {
|
||||
virtualDirectory: string,
|
||||
pageStatus: UserPageStatus,
|
||||
accountImage: AccountImage,
|
||||
friendsListPublic: boolean,
|
||||
personnalWebsite ?: string,
|
||||
publicNote ?: string,
|
||||
blockComments : boolean,
|
||||
allowPostsFromFriends: boolean,
|
||||
}
|
||||
|
||||
export class User {
|
||||
export class User implements UserBuilder {
|
||||
friendsListPublic: boolean;
|
||||
personnalWebsite?: string;
|
||||
publicNote?: string;
|
||||
blockComments: boolean;
|
||||
allowPostsFromFriends: boolean;
|
||||
id: number;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
@ -32,13 +42,24 @@ export class User {
|
||||
accountImage: AccountImage;
|
||||
|
||||
public constructor(info : UserBuilder) {
|
||||
this.id = info.id;
|
||||
this.firstName = info.firstName;
|
||||
this.lastName = info.lastName;
|
||||
this.timeCreate = info.timeCreate;
|
||||
this.virtualDirectory = info.virtualDirectory;
|
||||
this.pageStatus = info.pageStatus;
|
||||
this.accountImage = info.accountImage;
|
||||
for (const key in info) {
|
||||
if (info.hasOwnProperty(key)) {
|
||||
this[key] = info[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get hasWebsite() : boolean {
|
||||
return this.personnalWebsite
|
||||
&& this.personnalWebsite != null
|
||||
&& this.personnalWebsite.length > 0
|
||||
&& this.personnalWebsite != "null"
|
||||
}
|
||||
|
||||
get hasPublicNote() : boolean {
|
||||
return this.publicNote
|
||||
&& this.publicNote != null
|
||||
&& this.publicNote.length > 0
|
||||
&& this.publicNote != "null"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user