From 8e46984164b661a70ae65e355f09da7b83a6000e Mon Sep 17 00:00:00 2001 From: Florent Gravin Date: Fri, 24 Nov 2023 22:03:26 +0100 Subject: [PATCH] refactor(user): differenciate User & MeUser models make things clearer and move the User model in domain from gn4-api --- .../domain/src/lib/model/user/user.model.ts | 17 +++++++++++++++++ .../catalog/src/lib/my-org/my-org.service.ts | 4 ++-- .../lib/user-preview/user-preview.component.ts | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libs/common/domain/src/lib/model/user/user.model.ts b/libs/common/domain/src/lib/model/user/user.model.ts index 641d7439e5..efb591071c 100644 --- a/libs/common/domain/src/lib/model/user/user.model.ts +++ b/libs/common/domain/src/lib/model/user/user.model.ts @@ -8,3 +8,20 @@ export interface MeUserModel { organisation: string profileIcon?: string } + +export interface UserModel { + profile?: string + surname?: string + enabled?: boolean + username?: string + id?: number + email?: string + emailAddresses?: Set + organisation?: string + kind?: string + lastLoginDate?: string + accountNonExpired?: boolean + accountNonLocked?: boolean + credentialsNonExpired?: boolean + name?: string +} diff --git a/libs/feature/catalog/src/lib/my-org/my-org.service.ts b/libs/feature/catalog/src/lib/my-org/my-org.service.ts index 342f1c8d29..d01f743a6f 100644 --- a/libs/feature/catalog/src/lib/my-org/my-org.service.ts +++ b/libs/feature/catalog/src/lib/my-org/my-org.service.ts @@ -13,7 +13,7 @@ export class MyOrgService { logoUrl: string recordCount: number userCount: number - userList: UserApiModel[] + userList: UserModel[] }> private myOrgDataSubject = new BehaviorSubject<{ @@ -21,7 +21,7 @@ export class MyOrgService { logoUrl: string recordCount: number userCount: number - userList: UserApiModel[] + userList: UserModel[] }>({ orgName: '', logoUrl: '', diff --git a/libs/ui/elements/src/lib/user-preview/user-preview.component.ts b/libs/ui/elements/src/lib/user-preview/user-preview.component.ts index 89f369f4ec..213bb891e2 100644 --- a/libs/ui/elements/src/lib/user-preview/user-preview.component.ts +++ b/libs/ui/elements/src/lib/user-preview/user-preview.component.ts @@ -7,7 +7,7 @@ import { MeUserModel } from '@geonetwork-ui/common/domain/model/user/user.model' changeDetection: ChangeDetectionStrategy.OnPush, }) export class UserPreviewComponent { - @Input() user: UserModel + @Input() user: MeUserModel @Input() avatarPlaceholder?: string get userFullName() {