2023-03-04 08:54:01 +03:00
|
|
|
/* eslint-disable import/prefer-default-export */
|
|
|
|
export class User {
|
|
|
|
constructor(u) {
|
|
|
|
this.id = u.id;
|
|
|
|
this.displayName = u.displayName;
|
|
|
|
this.displayColor = u.displayColor;
|
|
|
|
this.createdAt = u.createdAt;
|
|
|
|
this.previousNames = u.previousNames;
|
|
|
|
this.nameChangedAt = u.nameChangedAt;
|
|
|
|
this.scopes = u.scopes;
|
|
|
|
this.authenticated = u.authenticated;
|
|
|
|
}
|
|
|
|
|
2022-04-30 01:09:53 +03:00
|
|
|
id: string;
|
2023-03-04 08:54:01 +03:00
|
|
|
|
2022-04-30 01:09:53 +03:00
|
|
|
displayName: string;
|
2023-03-04 08:54:01 +03:00
|
|
|
|
2022-04-30 01:09:53 +03:00
|
|
|
displayColor: number;
|
2023-03-04 08:54:01 +03:00
|
|
|
|
2022-04-30 01:09:53 +03:00
|
|
|
createdAt: Date;
|
2023-03-04 08:54:01 +03:00
|
|
|
|
2022-04-30 01:09:53 +03:00
|
|
|
previousNames: string[];
|
2023-03-04 08:54:01 +03:00
|
|
|
|
2022-04-30 01:09:53 +03:00
|
|
|
nameChangedAt: Date;
|
2023-03-04 08:54:01 +03:00
|
|
|
|
2022-04-30 01:09:53 +03:00
|
|
|
scopes: string[];
|
2023-03-04 08:54:01 +03:00
|
|
|
|
2022-08-21 02:13:31 +03:00
|
|
|
authenticated: boolean;
|
2023-03-04 08:54:01 +03:00
|
|
|
|
|
|
|
public isModerator = (): boolean => {
|
|
|
|
if (!this.scopes || this.scopes.length === 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-03-14 02:41:29 +03:00
|
|
|
return this.scopes.includes('MODERATOR');
|
2023-03-04 08:54:01 +03:00
|
|
|
};
|
2022-04-30 01:09:53 +03:00
|
|
|
}
|