]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/users/user.model.ts
Adapt scripts to typescript
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / users / user.model.ts
CommitLineData
7da18e44 1export class User {
feb4bdfd 2 id: number;
7da18e44
C
3 username: string;
4 role: string;
92fb909c 5 displayNSFW: boolean;
feb4bdfd 6 createdAt: Date;
7da18e44 7
92fb909c
C
8 constructor(hash: {
9 id: number,
10 username: string,
11 role: string,
12 displayNSFW?: boolean,
13 createdAt?: Date,
14 }) {
7da18e44
C
15 this.id = hash.id;
16 this.username = hash.username;
17 this.role = hash.role;
92fb909c 18 this.displayNSFW = hash.displayNSFW;
44c5275e 19
feb4bdfd
C
20 if (hash.createdAt) {
21 this.createdAt = hash.createdAt;
44c5275e 22 }
7da18e44
C
23 }
24
25 isAdmin() {
26 return this.role === 'admin';
27 }
28}