mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
add logging views
This commit is contained in:
parent
04696c46d4
commit
83361ea17d
18
backend/src/apis/humhub/logging/AccountLogging.view.ts
Normal file
18
backend/src/apis/humhub/logging/AccountLogging.view.ts
Normal file
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
23
backend/src/apis/humhub/logging/PostUserLogging.view.ts
Normal file
23
backend/src/apis/humhub/logging/PostUserLogging.view.ts
Normal file
@ -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,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
20
backend/src/apis/humhub/logging/ProfileLogging.view.ts
Normal file
20
backend/src/apis/humhub/logging/ProfileLogging.view.ts
Normal file
@ -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) + '...',
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user