diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 14be5ee6..8f0a7d4d 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -241,8 +241,11 @@ export class ProfileController extends Controller { profile.createdFullName = request.user.name; profile.lastUpdateUserId = request.user.sub; profile.lastUpdateFullName = request.user.name; + profile.dateRetire = calculateRetireDate(profile.birthDate); + profile.dateRetireLaw = calculateRetireDate(profile.birthDate); await this.profileRepo.save(profile); + return new HttpSuccess(); } @@ -379,7 +382,8 @@ export class ProfileController extends Controller { Object.assign(record, body); record.lastUpdateUserId = request.user.sub; record.lastUpdateFullName = request.user.name; - + record.dateRetire = calculateRetireDate(record.birthDate); + record.dateRetireLaw = calculateRetireDate(record.birthDate); await this.profileRepo.save(record); return new HttpSuccess(); diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 878206cd..2049cb0b 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -114,6 +114,8 @@ export class ProfileEmployeeController extends Controller { profile.createdFullName = request.user.name; profile.lastUpdateUserId = request.user.sub; profile.lastUpdateFullName = request.user.name; + profile.dateRetire = calculateRetireDate(profile.birthDate); + profile.dateRetireLaw = calculateRetireDate(profile.birthDate); await this.profileRepo.save(profile); return new HttpSuccess(); @@ -202,6 +204,8 @@ export class ProfileEmployeeController extends Controller { Object.assign(record, body); record.lastUpdateUserId = request.user.sub; record.lastUpdateFullName = request.user.name; + record.dateRetire = calculateRetireDate(record.birthDate); + record.dateRetireLaw = calculateRetireDate(record.birthDate); await this.profileRepo.save(record); diff --git a/src/entities/ProfileEducation.ts b/src/entities/ProfileEducation.ts index b0663604..5d8db29e 100644 --- a/src/entities/ProfileEducation.ts +++ b/src/entities/ProfileEducation.ts @@ -40,6 +40,7 @@ export class ProfileEducation extends EntityBase { @Column({ comment: "ระยะเวลาหลักสูตร", + nullable: true, }) durationYear: number; diff --git a/src/entities/ProfileEducationHistory.ts b/src/entities/ProfileEducationHistory.ts index f8fcf8aa..f7e661da 100644 --- a/src/entities/ProfileEducationHistory.ts +++ b/src/entities/ProfileEducationHistory.ts @@ -31,6 +31,7 @@ export class ProfileEducationHistory extends EntityBase { @Column({ comment: "ระยะเวลาหลักสูตร", + nullable: true, }) durationYear: number;