From 40c6cc32a7ae578020d93d48d2cd0ca7bc300698 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Thu, 28 Nov 2024 17:17:47 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9A=E0=B8=B1=E0=B8=84=20=E0=B8=97?= =?UTF-8?q?=E0=B8=B0=E0=B9=80=E0=B8=9A=E0=B8=B5=E0=B8=A2=E0=B8=99=E0=B8=9B?= =?UTF-8?q?=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4=20#812?= =?UTF-8?q?=20(3,4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ProfileController.ts | 10 +++++----- src/controllers/ProfileEmployeeController.ts | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 9744c29e..6fea64c1 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -1807,7 +1807,7 @@ export class ProfileController extends Controller { const profile = Object.assign(new Profile(), body); profile.prefixMain = profile.prefix; - profile.prefix = profile.rank ?? profile.prefixMain; + profile.prefix = profile.rank && profile.rank.length > 0?profile.rank:profile.prefixMain; profile.isProbation = false; profile.isLeave = false; profile.createdUserId = request.user.sub; @@ -1880,7 +1880,7 @@ export class ProfileController extends Controller { const profile: Profile = Object.assign(new Profile(), body); const _null: any = null; profile.prefixMain = profile.prefix; - profile.prefix = profile.rank ?? profile.prefixMain; + profile.prefix = profile.rank && profile.rank.length > 0?profile.rank:profile.prefixMain; profile.dateRetire = body.birthDate == null ? _null : calculateRetireDate(body.birthDate); profile.dateRetireLaw = body.birthDate == null ? _null : calculateRetireLaw(body.birthDate); profile.createdUserId = request.user.sub; @@ -1949,7 +1949,7 @@ export class ProfileController extends Controller { } const profile: Profile = Object.assign(new Profile(), body); profile.prefixMain = profile.prefix; - profile.prefix = profile.rank ?? profile.prefixMain; + profile.prefix = profile.rank && profile.rank.length > 0?profile.rank:profile.prefixMain; profile.createdUserId = request.user.sub; profile.createdFullName = request.user.name; profile.lastUpdateUserId = request.user.sub; @@ -3521,7 +3521,7 @@ export class ProfileController extends Controller { Object.assign(record, body); record.prefixMain = record.prefix; - record.prefix = record.rank ?? record.prefixMain; + record.prefix = record.rank && record.rank.length > 0?record.rank:record.prefixMain; record.createdUserId = request.user.sub; record.createdFullName = request.user.name; record.createdAt = new Date(); @@ -7898,7 +7898,7 @@ export class ProfileController extends Controller { } profile.prefixMain = profile.prefix; - profile.prefix = profile.rank ?? profile.prefixMain; + profile.prefix = profile.rank && profile.rank.length > 0?profile.rank:profile.prefixMain; profile.createdUserId = request.user.sub; profile.createdFullName = request.user.name; profile.lastUpdateUserId = request.user.sub; diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 66687c84..5f6feba2 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -830,7 +830,7 @@ export class ProfileEmployeeController extends Controller { const profile = Object.assign(new ProfileEmployee(), body); profile.prefixMain = profile.prefix; - profile.prefix = profile.rank ?? profile.prefixMain; + profile.prefix = profile.rank && profile.rank.length > 0?profile.rank:profile.prefixMain; profile.createdUserId = request.user.sub; profile.createdFullName = request.user.name; profile.lastUpdateUserId = request.user.sub; @@ -927,7 +927,7 @@ export class ProfileEmployeeController extends Controller { Object.assign(record, body); record.prefixMain = record.prefix; - record.prefix = record.rank ?? record.prefixMain; + record.prefix = record.rank && record.rank.length > 0?record.rank:record.prefixMain; record.createdUserId = request.user.sub; record.createdFullName = request.user.name; record.createdAt = new Date();