correct toJSON in case of undefined UserContact

This commit is contained in:
clauspeterhuebner 2025-12-16 22:56:23 +01:00
parent d00da185d7
commit bb69008f5f

View File

@ -17,21 +17,24 @@ export class UserContactLoggingView extends AbstractLoggingView {
public toJSON(): any {
return {
id: this.self.id,
type: this.self.type,
user:
this.showUser && this.self.user
? new UserLoggingView(this.self.user).toJSON()
: { id: this.self.userId },
email: this.self.email?.substring(0, 3) + '...',
emailVerificationCode: this.self.emailVerificationCode?.substring(0, 4) + '...',
emailOptInTypeId: OptInType[this.self.emailOptInTypeId],
emailResendCount: this.self.emailResendCount,
emailChecked: this.self.emailChecked,
phone: this.self.phone ? this.self.phone.substring(0, 3) + '...' : undefined,
createdAt: this.dateToString(this.self.createdAt),
updatedAt: this.dateToString(this.self.updatedAt),
deletedAt: this.dateToString(this.self.deletedAt),
self: this.self ?
{
id: this.self.id,
type: this.self.type,
user:
this.showUser && this.self.user
? new UserLoggingView(this.self.user).toJSON()
: { id: this.self.userId },
email: this.self.email?.substring(0, 3) + '...',
emailVerificationCode: this.self.emailVerificationCode?.substring(0, 4) + '...',
emailOptInTypeId: OptInType[this.self.emailOptInTypeId],
emailResendCount: this.self.emailResendCount,
emailChecked: this.self.emailChecked,
phone: this.self.phone ? this.self.phone.substring(0, 3) + '...' : undefined,
createdAt: this.dateToString(this.self.createdAt),
updatedAt: this.dateToString(this.self.updatedAt),
deletedAt: this.dateToString(this.self.deletedAt),
} : undefined
}
}
}