]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/users/user.model.ts
Fix concurrency error when deleting a video
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / users / user.model.ts
CommitLineData
df98563e 1import { User as UserServerModel, UserRole } from '../../../../../shared'
69f616ab
C
2
3export class User implements UserServerModel {
df98563e
C
4 id: number
5 username: string
6 email: string
7 role: UserRole
8 displayNSFW: boolean
b0f9f39e 9 videoQuota: number
df98563e 10 createdAt: Date
7da18e44 11
df98563e 12 constructor (hash: {
92fb909c
C
13 id: number,
14 username: string,
69f616ab 15 email: string,
46757b47 16 role: UserRole,
b0f9f39e 17 videoQuota?: number,
92fb909c 18 displayNSFW?: boolean,
df98563e 19 createdAt?: Date
92fb909c 20 }) {
df98563e
C
21 this.id = hash.id
22 this.username = hash.username
23 this.email = hash.email
24 this.role = hash.role
44c5275e 25
b0f9f39e
C
26 if (hash.videoQuota !== undefined) {
27 this.videoQuota = hash.videoQuota
28 }
29
30 if (hash.displayNSFW !== undefined) {
31 this.displayNSFW = hash.displayNSFW
32 }
33
34 if (hash.createdAt !== undefined) {
df98563e 35 this.createdAt = hash.createdAt
44c5275e 36 }
7da18e44
C
37 }
38
df98563e
C
39 isAdmin () {
40 return this.role === 'admin'
7da18e44
C
41 }
42}