fix search

This commit is contained in:
AdisakKanthawilang 2024-07-17 16:35:50 +07:00
parent 69db570268
commit 09c47361f1
3 changed files with 24 additions and 15 deletions

View file

@ -147,13 +147,13 @@ export class ProfileChangeNameController extends Controller {
profile.prefix = body.prefix ?? profile.prefix;
await this.profileRepository.save(profile);
// ปิดไว้ก่อนเพราะ error ต้องใช้ keycloak ที่มีสิทธิ์ในการ update
// if (profile != null && profile.keycloak != null) {
// const result = await updateName(profile.keycloak, profile.firstName, profile.lastName);
// if (!result) {
// throw new Error(result.errorMessage);
// }
// }
// ปิดไว้ก่อนเพราะ error ต้องใช้ keycloak ที่มีสิทธิ์ในการ update //update 17/07
if (profile != null && profile.keycloak != null) {
const result = await updateName(profile.keycloak, profile.firstName, profile.lastName);
if (!result) {
throw new Error(result.errorMessage);
}
}
return new HttpSuccess(data.id);
}
@ -200,13 +200,13 @@ export class ProfileChangeNameController extends Controller {
await this.profileRepository.save(profile);
}
// ปิดไว้ก่อนเพราะ error ต้องใช้ keycloak ที่มีสิทธิ์ในการ update
// if (profile != null && profile.keycloak != null) {
// const result = await updateName(profile.keycloak, profile.firstName, profile.lastName);
// if (!result) {
// throw new Error(result.errorMessage);
// }
// }
// ปิดไว้ก่อนเพราะ error ต้องใช้ keycloak ที่มีสิทธิ์ในการ update //update 17/07
if (profile != null && profile.keycloak != null) {
const result = await updateName(profile.keycloak, profile.firstName, profile.lastName);
if (!result) {
throw new Error(result.errorMessage);
}
}
return new HttpSuccess();
}

View file

@ -57,6 +57,7 @@ import { Prefixe } from "../entities/Prefixe";
import { ProfileInsignia } from "../entities/ProfileInsignia";
import { ProfileDisciplineHistory } from "../entities/ProfileDisciplineHistory";
import { ProfileLeave } from "../entities/ProfileLeave";
import { updateName } from "../keycloak";
@Route("api/v1/org/profile")
@Tags("Profile")
@ -2321,6 +2322,13 @@ export class ProfileController extends Controller {
record.dateRetireLaw = calculateRetireLaw(record.birthDate);
await this.profileRepo.save(record);
if (record != null && record.keycloak != null) {
const result = await updateName(record.keycloak, record.firstName, record.lastName);
if (!result) {
throw new Error(result.errorMessage);
}
}
return new HttpSuccess();
}

View file

@ -1329,7 +1329,8 @@ export class ProfileEmployeeController extends Controller {
.map((x) => x.next_holderId),
});
}),
)
)
.andWhere("profileEmployee.employeeClass = :employeeClass", {employeeClass:"PERM"})
.skip((requestBody.page - 1) * requestBody.pageSize)
.take(requestBody.pageSize)
.getManyAndCount();