make more similar

This commit is contained in:
einhorn_b 2024-01-09 16:41:45 +01:00
parent 3ec740e0a5
commit 92c0c4a090
7 changed files with 15 additions and 11 deletions

View File

@ -21,27 +21,27 @@ export abstract class AbstractLoggingView {
return this.toString()
}
public dateToString(date: Date | undefined | null): string | undefined {
protected dateToString(date: Date | undefined | null): string | undefined {
if (date) {
return date.toISOString()
}
return undefined
}
public decimalToString(number: Decimal | undefined | null): string | undefined {
protected decimalToString(number: Decimal | undefined | null): string | undefined {
if (number) {
return number.toString()
}
return undefined
}
public timestampSecondsToDateString(timestamp: TimestampSeconds): string | undefined {
protected timestampSecondsToDateString(timestamp: TimestampSeconds): string | undefined {
if (timestamp && timestamp.seconds) {
return timestampSecondsToDate(timestamp).toISOString()
}
}
public timestampToDateString(timestamp: Timestamp): string | undefined {
protected timestampToDateString(timestamp: Timestamp): string | undefined {
if (timestamp && (timestamp.seconds || timestamp.nanoSeconds)) {
return timestampToDate(timestamp).toISOString()
}

View File

@ -11,8 +11,7 @@ export class AccountLoggingView extends AbstractLoggingView {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
public toJSON() {
return {
id: this.account.id,
user: this.account.user ? new UserLoggingView(this.account.user).toJSON() : null,

View File

@ -8,7 +8,8 @@ export class SignatureMapLoggingView extends AbstractLoggingView {
super()
}
public toJSON() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
sigPair: this.self.sigPair.map((value) => new SignaturePairLoggingView(value).toJSON()),
}

View File

@ -7,7 +7,8 @@ export class SignaturePairLoggingView extends AbstractLoggingView {
super()
}
public toJSON() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
pubkey: Buffer.from(this.self.pubKey).toString(this.bufferStringFormat),
signature:

View File

@ -10,7 +10,8 @@ export class TransactionDraftLoggingView extends AbstractLoggingView {
super()
}
public toJSON() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
user: new UserIdentifierLoggingView(this.self.user).toJSON(),
linkedUser: new UserIdentifierLoggingView(this.self.linkedUser).toJSON(),

View File

@ -7,7 +7,8 @@ export class UserIdentifierLoggingView extends AbstractLoggingView {
super()
}
public toJSON() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
uuid: this.self.uuid,
communityUuid: this.self.communityUuid,

View File

@ -7,7 +7,8 @@ export class UserLoggingView extends AbstractLoggingView {
super()
}
public toJSON() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
id: this.user.id,
gradidoId: this.user.gradidoID,