This commit is contained in:
AdisakKanthawilang 2024-05-16 15:22:30 +07:00
parent 0524653f4b
commit 4dac692284
7 changed files with 26 additions and 22 deletions

View file

@ -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;