From c6df86331e6d43b89595dd38aaa2d641ebe0157a Mon Sep 17 00:00:00 2001
From: clauspeterhuebner
Date: Tue, 28 Jan 2025 16:54:30 +0100
Subject: [PATCH] use PublishNameLogic but replace empty string with null
---
backend/src/apis/gms/model/GmsUser.ts | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/backend/src/apis/gms/model/GmsUser.ts b/backend/src/apis/gms/model/GmsUser.ts
index a3025d16d..3c26917df 100644
--- a/backend/src/apis/gms/model/GmsUser.ts
+++ b/backend/src/apis/gms/model/GmsUser.ts
@@ -6,18 +6,19 @@ import { GmsPublishPhoneType } from '@/graphql/enum/GmsPublishPhoneType'
import { PublishNameType } from '@/graphql/enum/PublishNameType'
export class GmsUser {
- private pnLogic: PublishNameLogic
-
constructor(user: dbUser) {
- this.pnLogic = new PublishNameLogic(user)
+ const pnLogic = new PublishNameLogic(user)
+
this.userUuid = user.gradidoID
// this.communityUuid = user.communityUuid
this.language = user.language
this.email = this.getGmsEmail(user)
this.countryCode = this.getGmsCountryCode(user)
this.mobile = this.getGmsPhone(user)
- this.firstName = this.pnLogic.getFirstName(user.gmsPublishName) // getGmsFirstName(user)
- this.lastName = this.pnLogic.getLastName(user.gmsPublishName) // getGmsLastName(user)
+ const fn = pnLogic.getFirstName(user.gmsPublishName)
+ this.firstName = fn !== '' ? fn : null // getGmsFirstName(user)
+ const ln = pnLogic.getLastName(user.gmsPublishName)
+ this.lastName = ln !== '' ? ln : null // getGmsLastName(user)
this.alias = this.getGmsAlias(user)
this.type = user.gmsPublishLocation // GmsPublishLocationType.GMS_LOCATION_TYPE_RANDOM
this.location = user.location