2 User as UserServerModel,
7 } from '../../../../../shared'
9 export type UserConstructorHash = {
15 displayNSFW?: boolean,
21 videoChannels?: VideoChannel[]
23 export class User implements UserServerModel {
34 videoChannels: VideoChannel[]
37 constructor (hash: UserConstructorHash) {
39 this.username = hash.username
40 this.email = hash.email
42 this.account = hash.account
44 if (hash.videoChannels !== undefined) {
45 this.videoChannels = hash.videoChannels
48 if (hash.videoQuota !== undefined) {
49 this.videoQuota = hash.videoQuota
52 if (hash.displayNSFW !== undefined) {
53 this.displayNSFW = hash.displayNSFW
56 if (hash.createdAt !== undefined) {
57 this.createdAt = hash.createdAt
61 hasRight (right: UserRight) {
62 return hasUserRight(this.role, right)