fix issues in core

This commit is contained in:
2025-12-23 15:38:50 +01:00
parent df5c20c5cc
commit 120d3bb1a1
125 changed files with 1005 additions and 793 deletions

View File

@@ -31,6 +31,7 @@ export class User {
this.id = props.id;
this.displayName = props.displayName.trim();
this.email = props.email;
this.passwordHash = props.passwordHash;
this.iracingCustomerId = props.iracingCustomerId;
this.primaryDriverId = props.primaryDriverId;
this.avatarUrl = props.avatarUrl;
@@ -52,18 +53,20 @@ export class User {
}
public static fromStored(stored: StoredUser): User {
const passwordHash = stored.passwordHash ? PasswordHash.fromHash(stored.passwordHash) : undefined;
const userProps: any = {
const passwordHash = stored.passwordHash
? PasswordHash.fromHash(stored.passwordHash)
: undefined;
const userProps: UserProps = {
id: UserId.fromString(stored.id),
displayName: stored.displayName,
email: stored.email,
...(stored.email !== undefined ? { email: stored.email } : {}),
...(passwordHash !== undefined ? { passwordHash } : {}),
...(stored.primaryDriverId !== undefined
? { primaryDriverId: stored.primaryDriverId }
: {}),
};
if (passwordHash) {
userProps.passwordHash = passwordHash;
}
if (stored.primaryDriverId) {
userProps.primaryDriverId = stored.primaryDriverId;
}
return new User(userProps);
}