แก้ วันที่ 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

@ -29,7 +29,7 @@ export class ProfileGovernmentHistoryController 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,
},
@ -141,7 +141,7 @@ export class ProfileGovernmentHistoryController extends Controller {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const orgRevision = await this.orgRevisionRepository.findOne({
select: ["id"],
where: {
where: {
orgRevisionIsDraft: false,
orgRevisionIsCurrent: true,
},
@ -242,7 +242,7 @@ export class ProfileGovernmentHistoryController extends Controller {
public async getGovHistoryAdmin(@Path() profileId: string) {
const orgRevision = await this.orgRevisionRepository.findOne({
select: ["id"],
where: {
where: {
orgRevisionIsDraft: false,
orgRevisionIsCurrent: true,
},
@ -389,15 +389,18 @@ export class ProfileGovernmentHistoryController extends Controller {
const history = new ProfileGovernment();
Object.assign(record, body);
Object.assign(history, body);
Object.assign(history, { ...body, id: undefined });
history.profileId = profileId;
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.profileRepo.save(record), this.govRepo.save(history)]);