add update time
This commit is contained in:
parent
ad4efc2b47
commit
a2292d6048
57 changed files with 257 additions and 98 deletions
|
|
@ -35,7 +35,6 @@ export class ProfileAddressEmployeeController extends Controller {
|
|||
"currentDistrictId",
|
||||
"currentSubDistrictId",
|
||||
"currentZipCode",
|
||||
"createdAt",
|
||||
],
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
|
|
@ -70,7 +69,6 @@ export class ProfileAddressEmployeeController extends Controller {
|
|||
"currentDistrictId",
|
||||
"currentSubDistrictId",
|
||||
"currentZipCode",
|
||||
"createdAt",
|
||||
],
|
||||
});
|
||||
if (!getProfileAddress) {
|
||||
|
|
@ -92,12 +90,32 @@ export class ProfileAddressEmployeeController extends Controller {
|
|||
}
|
||||
const record = await this.profileAddressHistoryRepo.find({
|
||||
where: { profileEmployeeId: profile.id },
|
||||
order: { createdAt: "DESC" },
|
||||
relations: [
|
||||
"registrationProvince",
|
||||
"registrationDistrict",
|
||||
"registrationSubDistrict",
|
||||
"currentProvince",
|
||||
"currentDistrict",
|
||||
"currentSubDistrict",
|
||||
],
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
if (!record) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
return new HttpSuccess(record);
|
||||
const _record = record.map((item) => ({
|
||||
id: item.id,
|
||||
currentAddress: item.currentAddress,
|
||||
registrationAddress: item.registrationAddress,
|
||||
currentZipCode: item.currentZipCode,
|
||||
registrationZipCode: item.registrationZipCode,
|
||||
currentProvince: item.currentProvince?.name ?? null,
|
||||
registrationProvince: item.registrationProvince?.name ?? null,
|
||||
currentDistrict: item.currentDistrict?.name ?? null,
|
||||
registrationDistrict: item.registrationDistrict?.name ?? null,
|
||||
currentSubDistrict: item.currentSubDistrict?.name ?? null,
|
||||
registrationSubDistrict: item.registrationSubDistrict?.name ?? null,
|
||||
lastUpdatedAt: item.lastUpdatedAt,
|
||||
lastUpdateFullName: item.lastUpdateFullName,
|
||||
}));
|
||||
return new HttpSuccess(_record);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -113,12 +131,32 @@ export class ProfileAddressEmployeeController extends Controller {
|
|||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileId);
|
||||
const record = await this.profileAddressHistoryRepo.find({
|
||||
where: { profileEmployeeId: profileId },
|
||||
order: { createdAt: "DESC" },
|
||||
relations: [
|
||||
"registrationProvince",
|
||||
"registrationDistrict",
|
||||
"registrationSubDistrict",
|
||||
"currentProvince",
|
||||
"currentDistrict",
|
||||
"currentSubDistrict",
|
||||
],
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
if (!record) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
return new HttpSuccess(record);
|
||||
const _record = record.map((item) => ({
|
||||
id: item.id,
|
||||
currentAddress: item.currentAddress,
|
||||
registrationAddress: item.registrationAddress,
|
||||
currentZipCode: item.currentZipCode,
|
||||
registrationZipCode: item.registrationZipCode,
|
||||
currentProvince: item.currentProvince?.name ?? null,
|
||||
registrationProvince: item.registrationProvince?.name ?? null,
|
||||
currentDistrict: item.currentDistrict?.name ?? null,
|
||||
registrationDistrict: item.registrationDistrict?.name ?? null,
|
||||
currentSubDistrict: item.currentSubDistrict?.name ?? null,
|
||||
registrationSubDistrict: item.registrationSubDistrict?.name ?? null,
|
||||
lastUpdatedAt: item.lastUpdatedAt,
|
||||
lastUpdateFullName: item.lastUpdateFullName,
|
||||
}));
|
||||
return new HttpSuccess(_record);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -139,7 +177,7 @@ export class ProfileAddressEmployeeController extends Controller {
|
|||
const history = new ProfileAddressHistory();
|
||||
|
||||
Object.assign(record, body);
|
||||
Object.assign(history, { ...body, id: undefined });
|
||||
Object.assign(history, { ...record, id: undefined });
|
||||
|
||||
history.profileEmployeeId = profileId;
|
||||
record.lastUpdateUserId = req.user.sub;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue