add update time
This commit is contained in:
parent
ad4efc2b47
commit
a2292d6048
57 changed files with 257 additions and 98 deletions
|
|
@ -34,7 +34,6 @@ export class ProfileAddressController extends Controller {
|
|||
"currentDistrictId",
|
||||
"currentSubDistrictId",
|
||||
"currentZipCode",
|
||||
"createdAt",
|
||||
],
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
|
|
@ -66,7 +65,6 @@ export class ProfileAddressController extends Controller {
|
|||
"currentDistrictId",
|
||||
"currentSubDistrictId",
|
||||
"currentZipCode",
|
||||
"createdAt",
|
||||
],
|
||||
});
|
||||
if (!getProfileAddress) {
|
||||
|
|
@ -88,12 +86,32 @@ export class ProfileAddressController extends Controller {
|
|||
}
|
||||
const record = await this.profileAddressHistoryRepo.find({
|
||||
where: { profileId: 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -109,12 +127,32 @@ export class ProfileAddressController extends Controller {
|
|||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const record = await this.profileAddressHistoryRepo.find({
|
||||
where: { profileId: 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -135,7 +173,7 @@ export class ProfileAddressController extends Controller {
|
|||
const history = new ProfileAddressHistory();
|
||||
|
||||
Object.assign(record, body);
|
||||
Object.assign(history, { ...body, id: undefined });
|
||||
Object.assign(history, { ...record, id: undefined });
|
||||
|
||||
history.profileId = profileId;
|
||||
record.lastUpdateUserId = req.user.sub;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue