2019-11-23 16:10:51 +01:00
|
|
|
import { AccountImage } from "./AccountImage";
|
|
|
|
|
2019-11-23 15:11:33 +01:00
|
|
|
/**
|
|
|
|
* 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,
|
2019-12-28 14:01:10 +01:00
|
|
|
friendsListPublic: boolean,
|
|
|
|
personnalWebsite ?: string,
|
|
|
|
publicNote ?: string,
|
|
|
|
blockComments : boolean,
|
|
|
|
allowPostsFromFriends: boolean,
|
2019-11-23 15:11:33 +01:00
|
|
|
}
|
|
|
|
|
2019-12-28 14:01:10 +01:00
|
|
|
export class User implements UserBuilder {
|
|
|
|
friendsListPublic: boolean;
|
|
|
|
personnalWebsite?: string;
|
|
|
|
publicNote?: string;
|
|
|
|
blockComments: boolean;
|
|
|
|
allowPostsFromFriends: boolean;
|
2019-11-23 15:11:33 +01:00
|
|
|
id: number;
|
|
|
|
firstName: string;
|
|
|
|
lastName: string;
|
|
|
|
timeCreate: number;
|
|
|
|
virtualDirectory: string;
|
|
|
|
pageStatus: UserPageStatus;
|
2019-11-23 16:10:51 +01:00
|
|
|
accountImage: AccountImage;
|
2019-11-23 15:11:33 +01:00
|
|
|
|
|
|
|
public constructor(info : UserBuilder) {
|
2019-12-28 14:01:10 +01:00
|
|
|
for (const key in info) {
|
|
|
|
if (info.hasOwnProperty(key)) {
|
|
|
|
this[key] = info[key];
|
|
|
|
}
|
|
|
|
}
|
2019-11-23 15:11:33 +01:00
|
|
|
}
|
|
|
|
|
2019-12-28 14:01:10 +01:00
|
|
|
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"
|
|
|
|
}
|
2019-11-23 15:11:33 +01:00
|
|
|
}
|