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();