add update time

This commit is contained in:
kittapath 2024-09-01 22:44:23 +07:00
parent ad4efc2b47
commit a2292d6048
57 changed files with 257 additions and 98 deletions

View file

@ -2388,6 +2388,12 @@ export class ProfileController extends Controller {
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์นี้");
Object.assign(record, body);
record.lastUpdateUserId = request.user.sub;
record.lastUpdateFullName = request.user.name;
record.lastUpdatedAt = new Date();
record.dateRetire = calculateRetireDate(record.birthDate);
record.dateRetireLaw = calculateRetireLaw(record.birthDate);
await this.profileHistoryRepo.save(
Object.assign(new ProfileHistory(), {
...record,
@ -2395,13 +2401,6 @@ export class ProfileController extends Controller {
id: undefined,
}),
);
Object.assign(record, body);
record.lastUpdateUserId = request.user.sub;
record.lastUpdateFullName = request.user.name;
record.lastUpdatedAt = new Date();
record.dateRetire = calculateRetireDate(record.birthDate);
record.dateRetireLaw = calculateRetireLaw(record.birthDate);
await this.profileRepo.save(record);
if (record != null && record.keycloak != null) {