user.model.ts 751 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* eslint-disable import/prefer-default-export */
  2. export class User {
  3. constructor(u) {
  4. this.id = u.id;
  5. this.displayName = u.displayName;
  6. this.displayColor = u.displayColor;
  7. this.createdAt = u.createdAt;
  8. this.previousNames = u.previousNames;
  9. this.nameChangedAt = u.nameChangedAt;
  10. this.scopes = u.scopes;
  11. this.authenticated = u.authenticated;
  12. this.isBot = u.isBot;
  13. if (this.scopes && this.scopes.length > 0) {
  14. this.isModerator = this.scopes.includes('MODERATOR');
  15. }
  16. }
  17. id: string;
  18. displayName: string;
  19. displayColor: number;
  20. createdAt: Date;
  21. previousNames: string[];
  22. nameChangedAt: Date;
  23. scopes: string[];
  24. authenticated: boolean;
  25. isBot: boolean;
  26. isModerator: boolean;
  27. }