แก้ วันที่ update

This commit is contained in:
kittapath 2024-08-30 18:02:34 +07:00
parent 6d36c9b05f
commit 218886b3f4
83 changed files with 1671 additions and 3483 deletions

View file

@ -46,7 +46,7 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
public async getGovHistoryUser(@Request() request: { user: Record<string, any> }) {
const orgRevision = await this.orgRevisionRepository.findOne({
select: ["id"],
where: {
where: {
orgRevisionIsDraft: false,
orgRevisionIsCurrent: true,
},
@ -147,7 +147,7 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
const orgRevision = await this.orgRevisionRepository.findOne({
select: ["id"],
where: {
where: {
orgRevisionIsDraft: false,
orgRevisionIsCurrent: true,
},
@ -239,7 +239,7 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
public async getGovHistoryAdmin(@Path() profileEmployeeId: string) {
const orgRevision = await this.orgRevisionRepository.findOne({
select: ["id"],
where: {
where: {
orgRevisionIsDraft: false,
orgRevisionIsCurrent: true,
},
@ -372,15 +372,18 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
const history = new ProfileGovernment();
Object.assign(record, body);
Object.assign(history, body);
Object.assign(history, { ...body, id: undefined });
history.profileEmployeeId = profileEmployeeId;
record.lastUpdateUserId = req.user.sub;
record.lastUpdateFullName = req.user.name;
record.lastUpdatedAt = new Date();
history.lastUpdateUserId = req.user.sub;
history.lastUpdateFullName = req.user.name;
history.createdUserId = req.user.sub;
history.createdFullName = req.user.name;
history.createdAt = new Date();
history.lastUpdatedAt = new Date();
await Promise.all([this.profileEmployeeRepo.save(record), this.govRepo.save(history)]);
return new HttpSuccess();