2023-03-03 21:54:01 -08: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-29 15:09:53 -07:00
|
|
|
id: string;
|
2023-03-03 21:54:01 -08:00
|
|
|
|
2022-04-29 15:09:53 -07:00
|
|
|
displayName: string;
|
2023-03-03 21:54:01 -08:00
|
|
|
|
2022-04-29 15:09:53 -07:00
|
|
|
displayColor: number;
|
2023-03-03 21:54:01 -08:00
|
|
|
|
2022-04-29 15:09:53 -07:00
|
|
|
createdAt: Date;
|
2023-03-03 21:54:01 -08:00
|
|
|
|
2022-04-29 15:09:53 -07:00
|
|
|
previousNames: string[];
|
2023-03-03 21:54:01 -08:00
|
|
|
|
2022-04-29 15:09:53 -07:00
|
|
|
nameChangedAt: Date;
|
2023-03-03 21:54:01 -08:00
|
|
|
|
2022-04-29 15:09:53 -07:00
|
|
|
scopes: string[];
|
2023-03-03 21:54:01 -08:00
|
|
|
|
2022-08-20 16:13:31 -07:00
|
|
|
authenticated: boolean;
|
2023-03-03 21:54:01 -08:00
|
|
|
|
|
|
|
public isModerator = (): boolean => {
|
|
|
|
if (!this.scopes || this.scopes.length === 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-03-13 16:41:29 -07:00
|
|
|
return this.scopes.includes('MODERATOR');
|
2023-03-03 21:54:01 -08:00
|
|
|
};
|
2022-04-29 15:09:53 -07:00
|
|
|
}
|