แก้ api เก็บประวัติแก้ทะเบียน
This commit is contained in:
parent
576f6bcc0d
commit
fd3f1fa515
62 changed files with 855 additions and 1471 deletions
|
|
@ -140,15 +140,20 @@ export class ProfileChangeNameController extends Controller {
|
|||
};
|
||||
|
||||
Object.assign(data, { ...body, ...meta });
|
||||
const history = new ProfileChangeNameHistory();
|
||||
history.profileChangeNameId = data.id;
|
||||
|
||||
await this.changeNameRepository.save(data);
|
||||
await Promise.all([
|
||||
this.changeNameRepository.save(data),
|
||||
(history.profileChangeNameId = data.id),
|
||||
this.changeNameHistoryRepository.save(history),
|
||||
]);
|
||||
|
||||
profile.firstName = body.firstName ?? profile.firstName;
|
||||
profile.lastName = body.lastName ?? profile.lastName;
|
||||
profile.prefix = body.prefix ?? profile.prefix;
|
||||
await this.profileRepository.save(profile);
|
||||
|
||||
// ปิดไว้ก่อนเพราะ error ต้องใช้ keycloak ที่มีสิทธิ์ในการ update //update 17/07
|
||||
if (profile != null && profile.keycloak != null) {
|
||||
const result = await updateName(profile.keycloak, profile.firstName, profile.lastName);
|
||||
if (!result) {
|
||||
|
|
@ -172,11 +177,16 @@ export class ProfileChangeNameController extends Controller {
|
|||
|
||||
const history = new ProfileChangeNameHistory();
|
||||
|
||||
Object.assign(history, { ...record, id: undefined });
|
||||
Object.assign(record, body);
|
||||
Object.assign(history, body);
|
||||
|
||||
history.profileChangeNameId = changeNameId;
|
||||
record.lastUpdateUserId = req.user.sub;
|
||||
record.lastUpdateFullName = req.user.name;
|
||||
history.lastUpdateUserId = req.user.sub;
|
||||
history.lastUpdateFullName = req.user.name;
|
||||
history.createdUserId = req.user.sub;
|
||||
history.createdFullName = req.user.name;
|
||||
|
||||
await Promise.all([
|
||||
this.changeNameRepository.save(record),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue