This commit is contained in:
AdisakKanthawilang 2025-05-06 18:23:07 +07:00
parent 397c39f92a
commit 14b824fe3d

View file

@ -5402,16 +5402,16 @@ export class CommandController extends Controller {
profile.isProbation = item.bodyProfile.isProbation;
//เพิ่มใหม่จากรับโอน
profile.prefix = item.bodyProfile.prefix && item.bodyProfile.prefix != "" ?item.bodyProfile.prefix : profile.prefix;
profile.firstName = item.bodyProfile.firstName && item.bodyProfile.firstName != "" ? item.bodyProfile.firstName : profile.firstName;
profile.lastName = item.bodyProfile.lastName && item.bodyProfile.lastName != "" ? item.bodyProfile.lastName : profile.lastName;
profile.birthDate = item.bodyProfile.birthDate ? item.bodyProfile.birthDate : profile.birthDate;
profile.gender = item.bodyProfile.gender && item.bodyProfile.gender != "" ? item.bodyProfile.gender : profile.gender;
profile.relationship = item.bodyProfile.relationship && item.bodyProfile.relationship != "" ? item.bodyProfile.relationship : profile.relationship;
profile.religion = item.bodyProfile.religion && item.bodyProfile.religion != "" ? item.bodyProfile.religion : profile.religion;
profile.nationality = item.bodyProfile.nationality && item.bodyProfile.nationality != "" ? item.bodyProfile.nationality : profile.nationality;
profile.bloodGroup = item.bodyProfile.bloodGroup && item.bodyProfile.bloodGroup != "" ? item.bodyProfile.bloodGroup : profile.bloodGroup;
profile.phone = item.bodyProfile.phone && item.bodyProfile.phone != "" ? item.bodyProfile.phone : profile.phone;
profile.prefix = item.bodyProfile.prefix ?? null;
profile.firstName = item.bodyProfile.firstName ?? null;
profile.lastName = item.bodyProfile.lastName ?? null;
profile.birthDate = item.bodyProfile.birthDate ?? null;
profile.gender = item.bodyProfile.gender ?? null;
profile.relationship = item.bodyProfile.relationship ?? null;
profile.religion = item.bodyProfile.religion ?? null;
profile.nationality = item.bodyProfile.nationality ?? null;
profile.bloodGroup = item.bodyProfile.bloodGroup ?? null;
profile.phone = item.bodyProfile.phone ?? null;
await this.profileRepository.save(profile);
setLogDataDiff(req, { before, after: profile });
@ -5455,6 +5455,18 @@ export class CommandController extends Controller {
profile.lastUpdateUserId = req.user.sub;
profile.lastUpdateFullName = req.user.name;
profile.lastUpdatedAt = new Date();
//เพิ่มใหม่จากรับโอน
profile.prefix = item.bodyProfile.prefix && item.bodyProfile.prefix != "" ? item.bodyProfile.prefix : profile.prefix;
profile.firstName = item.bodyProfile.firstName && item.bodyProfile.firstName != "" ? item.bodyProfile.firstName : profile.firstName;
profile.lastName = item.bodyProfile.lastName && item.bodyProfile.lastName != "" ? item.bodyProfile.lastName : profile.lastName;
profile.birthDate = item.bodyProfile.birthDate ? item.bodyProfile.birthDate : profile.birthDate;
profile.gender = item.bodyProfile.gender && item.bodyProfile.gender != "" ? item.bodyProfile.gender : profile.gender;
profile.relationship = item.bodyProfile.relationship && item.bodyProfile.relationship != "" ? item.bodyProfile.relationship : profile.relationship;
profile.religion = item.bodyProfile.religion && item.bodyProfile.religion != "" ? item.bodyProfile.religion : profile.religion;
profile.nationality = item.bodyProfile.nationality && item.bodyProfile.nationality != "" ? item.bodyProfile.nationality : profile.nationality;
profile.bloodGroup = item.bodyProfile.bloodGroup && item.bodyProfile.bloodGroup != "" ? item.bodyProfile.bloodGroup : profile.bloodGroup;
profile.phone = item.bodyProfile.phone && item.bodyProfile.phone != "" ? item.bodyProfile.phone : profile.phone;
await this.profileRepository.save(profile);
setLogDataDiff(req, { before, after: profile });
}