diff --git a/backend/src/apis/humhub/logging/AccountLogging.view.ts b/backend/src/apis/humhub/logging/AccountLogging.view.ts new file mode 100644 index 000000000..e5a2df565 --- /dev/null +++ b/backend/src/apis/humhub/logging/AccountLogging.view.ts @@ -0,0 +1,18 @@ +import { AbstractLoggingView } from '@logging/AbstractLogging.view' + +import { Account } from '@/apis/humhub/model/Account' + +export class AccountLoggingView extends AbstractLoggingView { + public constructor(private self: Account) { + super() + } + + public toJSON(): Account { + return { + username: this.self.username.substring(0, 3) + '...', + email: this.self.email.substring(0, 3) + '...', + language: this.self.language, + status: this.self.status, + } + } +} diff --git a/backend/src/apis/humhub/logging/PostUserLogging.view.ts b/backend/src/apis/humhub/logging/PostUserLogging.view.ts new file mode 100644 index 000000000..47123c08b --- /dev/null +++ b/backend/src/apis/humhub/logging/PostUserLogging.view.ts @@ -0,0 +1,23 @@ +import { AbstractLoggingView } from '@logging/AbstractLogging.view' + +import { PostUser } from '@/apis/humhub/model/PostUser' + +import { AccountLoggingView } from './AccountLogging.view' +import { ProfileLoggingView } from './ProfileLogging.view' + +export class PostUserLoggingView extends AbstractLoggingView { + public constructor(private self: PostUser) { + super() + } + + public toJSON(): PostUser { + return { + account: new AccountLoggingView(this.self.account).toJSON(), + profile: new ProfileLoggingView(this.self.profile).toJSON(), + password: { + newPassword: '', + mustChangePassword: false, + }, + } + } +} diff --git a/backend/src/apis/humhub/logging/ProfileLogging.view.ts b/backend/src/apis/humhub/logging/ProfileLogging.view.ts new file mode 100644 index 000000000..1c107676d --- /dev/null +++ b/backend/src/apis/humhub/logging/ProfileLogging.view.ts @@ -0,0 +1,20 @@ +import { AbstractLoggingView } from '@logging/AbstractLogging.view' + +import { Profile } from '@/apis/humhub/model/Profile' + +export class ProfileLoggingView extends AbstractLoggingView { + public constructor(private self: Profile) { + super() + } + + public toJSON(): Profile { + const gradidoAddressParts = this.self.gradido_address.split('/') + return { + firstname: this.self.firstname.substring(0, 3) + '...', + lastname: this.self.lastname.substring(0, 3) + '...', + // eslint-disable-next-line camelcase + gradido_address: + gradidoAddressParts[0] + '/' + gradidoAddressParts[1].substring(0, 3) + '...', + } + } +}