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 || "??? ???"; } }