1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-02-17 06:32:39 +00:00

65 lines
1.3 KiB
TypeScript
Raw Normal View History

2019-11-23 16:10:51 +01:00
import { AccountImage } from "./AccountImage";
/**
* User information
*
* @author Pierre HUBERT
*/
export enum UserPageStatus {
PRIVATE,
PUBLIC,
OPEN
}
export interface UserBuilder {
id: number,
firstName: string,
lastName: string,
timeCreate: number,
virtualDirectory: string,
pageStatus: UserPageStatus,
2019-11-23 16:10:51 +01:00
accountImage: AccountImage,
friendsListPublic: boolean,
personnalWebsite ?: string,
publicNote ?: string,
blockComments : boolean,
allowPostsFromFriends: boolean,
}
export class User implements UserBuilder {
friendsListPublic: boolean;
personnalWebsite?: string;
publicNote?: string;
blockComments: boolean;
allowPostsFromFriends: boolean;
id: number;
firstName: string;
lastName: string;
timeCreate: number;
virtualDirectory: string;
pageStatus: UserPageStatus;
2019-11-23 16:10:51 +01:00
accountImage: AccountImage;
public constructor(info : UserBuilder) {
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"
}
}