You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
938 B
51 lines
938 B
import { Expose, Type } from 'class-transformer';
|
|
import { Racer } from './racer.model';
|
|
|
|
export class User {
|
|
@Expose()
|
|
auth0id: string = "";
|
|
|
|
@Expose()
|
|
nickname: string = "";
|
|
|
|
@Expose()
|
|
email: string = "";
|
|
|
|
@Expose()
|
|
picture: string = "";
|
|
|
|
@Expose()
|
|
realName: string = "";
|
|
|
|
@Expose()
|
|
lastLogin: Date | null = null;
|
|
|
|
@Expose({ name: 'racer' })
|
|
@Type(() => Racer)
|
|
racer: Racer | null = null;
|
|
|
|
getUserName() : string {
|
|
return this.nickname;
|
|
}
|
|
|
|
getUserId() : string {
|
|
return this.auth0id.replace("auth0|", "") || "";
|
|
}
|
|
|
|
compareId(otherId: string) {
|
|
let other = otherId.replace("auth0|", "")
|
|
return this.getUserId() == other;
|
|
}
|
|
|
|
getUserPicture() : string {
|
|
return this.picture || "";
|
|
}
|
|
|
|
getUserEmail() : string {
|
|
return this.email || "";
|
|
}
|
|
|
|
getUserRealName() : string {
|
|
return this.realName || "??? ???";
|
|
}
|
|
}
|
|
|