fix
This commit is contained in:
parent
0524653f4b
commit
4dac692284
7 changed files with 26 additions and 22 deletions
|
|
@ -69,10 +69,10 @@ export class ProfileAddressEmployeeController extends Controller {
|
|||
* @summary ประวัติแก้ไขที่อยู่
|
||||
*
|
||||
*/
|
||||
@Get("history/{addressId}")
|
||||
public async getProfileAddressHistory(@Path() addressId: string) {
|
||||
@Get("history/{profileId}")
|
||||
public async getProfileAddressHistory(@Path() profileId: string) {
|
||||
const record = await this.profileAddressHistoryRepo.find({
|
||||
where: { profileEmployeeId: addressId },
|
||||
where: { profileEmployeeId: profileId },
|
||||
relations: {
|
||||
registrationProvince: true,
|
||||
registrationDistrict: true,
|
||||
|
|
@ -107,13 +107,13 @@ export class ProfileAddressEmployeeController extends Controller {
|
|||
* @summary แก้ไขที่อยู่
|
||||
*
|
||||
*/
|
||||
@Patch("{addressId}")
|
||||
@Patch("{profileId}")
|
||||
public async editProfileAddress(
|
||||
@Body() requestBody: UpdateProfileAddressEmployee,
|
||||
@Request() req: RequestWithUser,
|
||||
@Path() addressId: string,
|
||||
@Path() profileId: string,
|
||||
) {
|
||||
const record = await this.profileEmployeeRepo.findOneBy({ id: addressId });
|
||||
const record = await this.profileEmployeeRepo.findOneBy({ id: profileId });
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
const history = new ProfileAddressHistory();
|
||||
|
|
@ -121,7 +121,7 @@ export class ProfileAddressEmployeeController extends Controller {
|
|||
Object.assign(history, { ...record, id: undefined });
|
||||
Object.assign(record, requestBody);
|
||||
|
||||
history.profileEmployeeId = addressId;
|
||||
history.profileEmployeeId = profileId;
|
||||
history.lastUpdateFullName = req.user.name;
|
||||
record.lastUpdateFullName = req.user.name;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue