no message
This commit is contained in:
parent
992a48b787
commit
9abdeca45b
5 changed files with 197 additions and 181 deletions
|
|
@ -943,7 +943,7 @@ export class CommandController extends Controller {
|
|||
await new permission().PermissionGet(request, "COMMAND");
|
||||
const command = await this.commandRepository.findOne({
|
||||
where: { id },
|
||||
relations: ["commandType"]
|
||||
relations: ["commandType"],
|
||||
});
|
||||
if (!command) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
||||
|
|
@ -1165,7 +1165,7 @@ export class CommandController extends Controller {
|
|||
await new permission().PermissionUpdate(request, "COMMAND");
|
||||
const command = await this.commandRepository.findOne({
|
||||
where: { id: id },
|
||||
relations: ["commandType", "commandRecives",],
|
||||
relations: ["commandType", "commandRecives"],
|
||||
});
|
||||
if (!command) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
||||
|
|
@ -1255,7 +1255,7 @@ export class CommandController extends Controller {
|
|||
let _data: any = null;
|
||||
await Promise.all([
|
||||
await new CallAPI()
|
||||
.PostDataKeycloak("/realms/bma-ehr/protocol/openid-connect/token", data)
|
||||
.PostDataKeycloak(`/realms/${process.env.KC_REALM}/protocol/openid-connect/token`, data)
|
||||
.then(async (x) => {
|
||||
_data = x;
|
||||
})
|
||||
|
|
@ -2265,16 +2265,22 @@ export class CommandController extends Controller {
|
|||
lastName: profile.lastName,
|
||||
});
|
||||
// กรณี Keycloak ไม่ถูกลบ ให้ลบซ้ำอีกรอบแล้วสร้างใหม่ และหากยังไม่สามารถลบได้ให้แสดง Error
|
||||
if (profile.keycloak != null && userKeycloakId && userKeycloakId.errorMessage === "User exists with same username") {
|
||||
if (
|
||||
profile.keycloak != null &&
|
||||
userKeycloakId &&
|
||||
userKeycloakId.errorMessage === "User exists with same username"
|
||||
) {
|
||||
const delUserKeycloak = await deleteUser(profile.keycloak);
|
||||
if (delUserKeycloak) {
|
||||
userKeycloakId = await createUser(profile.citizenId, profile.citizenId, {
|
||||
firstName: profile.firstName,
|
||||
lastName: profile.lastName,
|
||||
});
|
||||
}
|
||||
else {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "พบข้อผิดพลาด ไม่สามารถจัดการผู้ใช้งานได้");
|
||||
} else {
|
||||
throw new HttpError(
|
||||
HttpStatus.BAD_REQUEST,
|
||||
"พบข้อผิดพลาด ไม่สามารถจัดการผู้ใช้งานได้",
|
||||
);
|
||||
}
|
||||
}
|
||||
const list = await getRoles();
|
||||
|
|
@ -3792,7 +3798,9 @@ export class CommandController extends Controller {
|
|||
if (
|
||||
orgRevision != null &&
|
||||
!["REPORT", "DONE"].includes(
|
||||
orgRevision.posMasters.find((x) => x.statusReport === "REPORT" || x.statusReport === "DONE")?.statusReport || "",
|
||||
orgRevision.posMasters.find(
|
||||
(x) => x.statusReport === "REPORT" || x.statusReport === "DONE",
|
||||
)?.statusReport || "",
|
||||
)
|
||||
) {
|
||||
await this.orgRevisionRepo.update(orgRevision.id, {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export class LoginController extends Controller {
|
|||
let _data: any = null;
|
||||
await Promise.all([
|
||||
await new CallAPI()
|
||||
.PostDataKeycloak("/realms/bma-ehr/protocol/openid-connect/token", data)
|
||||
.PostDataKeycloak(`/realms/${process.env.KC_REALM}/protocol/openid-connect/token`, data)
|
||||
.then(async (x) => {
|
||||
_data = x;
|
||||
})
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ export class ProfileController extends Controller {
|
|||
: "-",
|
||||
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||
educations: Education,
|
||||
url: ImgUrl ? ImgUrl : `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
|
||||
url: ImgUrl ? ImgUrl : `${process.env.VITE_URL_SSO}/assets/avatar_user-89f22423.jpg`,
|
||||
};
|
||||
|
||||
return new HttpSuccess({
|
||||
|
|
@ -715,7 +715,7 @@ export class ProfileController extends Controller {
|
|||
: "",
|
||||
telephone:
|
||||
profiles.telephoneNumber != null ? Extension.ToThaiNumber(profiles.telephoneNumber) : "",
|
||||
url: ImgUrl ? ImgUrl : `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
|
||||
url: ImgUrl ? ImgUrl : `${process.env.VITE_URL_SSO}/assets/avatar_user-89f22423.jpg`,
|
||||
url1: _ImgUrl[0] ? _ImgUrl[0] : null,
|
||||
yearUpload1: profiles.profileAvatars[0]
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[0].createdAt))
|
||||
|
|
@ -4248,8 +4248,8 @@ export class ProfileController extends Controller {
|
|||
{
|
||||
keyword: `%${searchKeyword}%`,
|
||||
},
|
||||
)
|
||||
})
|
||||
);
|
||||
}),
|
||||
)
|
||||
.orderBy("current_holders.posMasterNo", "ASC")
|
||||
.skip((page - 1) * pageSize)
|
||||
|
|
@ -6030,8 +6030,8 @@ export class ProfileController extends Controller {
|
|||
where: {
|
||||
citizenId: Like(`%${body.keyword}%`),
|
||||
current_holders: {
|
||||
orgRevisionId:revision?.id
|
||||
}
|
||||
orgRevisionId: revision?.id,
|
||||
},
|
||||
},
|
||||
relations: [
|
||||
"posType",
|
||||
|
|
@ -6050,7 +6050,8 @@ export class ProfileController extends Controller {
|
|||
break;
|
||||
|
||||
case "fullName":
|
||||
[findProfile, total] = await this.profileRepo.createQueryBuilder("profile")
|
||||
[findProfile, total] = await this.profileRepo
|
||||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.posType", "posType")
|
||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||
|
|
@ -6060,7 +6061,10 @@ export class ProfileController extends Controller {
|
|||
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||
.where("current_holders.orgRevision = :revisionId", { revisionId: revision?.id })
|
||||
.andWhere("CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword", { keyword: `%${body.keyword}%` })
|
||||
.andWhere(
|
||||
"CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword",
|
||||
{ keyword: `%${body.keyword}%` },
|
||||
)
|
||||
.skip(skip)
|
||||
.take(take)
|
||||
.getManyAndCount();
|
||||
|
|
@ -6071,8 +6075,8 @@ export class ProfileController extends Controller {
|
|||
where: {
|
||||
position: Like(`%${body.keyword}%`),
|
||||
current_holders: {
|
||||
orgRevisionId:revision?.id
|
||||
}
|
||||
orgRevisionId: revision?.id,
|
||||
},
|
||||
},
|
||||
relations: [
|
||||
"posType",
|
||||
|
|
@ -6091,7 +6095,8 @@ export class ProfileController extends Controller {
|
|||
break;
|
||||
|
||||
case "posNo":
|
||||
[findProfile, total] = await this.profileRepo.createQueryBuilder("profile")
|
||||
[findProfile, total] = await this.profileRepo
|
||||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.posType", "posType")
|
||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||
|
|
@ -6103,13 +6108,15 @@ export class ProfileController extends Controller {
|
|||
.where("current_holders.orgRevision = :revisionId", { revisionId: revision?.id })
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere(body.keyword != undefined && body.keyword != null && body.keyword != ""
|
||||
qb.orWhere(
|
||||
body.keyword != undefined && body.keyword != null && body.keyword != ""
|
||||
? queryLike
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
})
|
||||
})
|
||||
},
|
||||
);
|
||||
}),
|
||||
)
|
||||
.skip(skip)
|
||||
.take(take)
|
||||
|
|
@ -6120,11 +6127,11 @@ export class ProfileController extends Controller {
|
|||
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||
where: {
|
||||
posType: {
|
||||
posTypeName:Like(`%${body.keyword}%`)
|
||||
posTypeName: Like(`%${body.keyword}%`),
|
||||
},
|
||||
current_holders: {
|
||||
orgRevisionId:revision?.id
|
||||
}
|
||||
orgRevisionId: revision?.id,
|
||||
},
|
||||
},
|
||||
relations: [
|
||||
"posType",
|
||||
|
|
@ -6146,11 +6153,11 @@ export class ProfileController extends Controller {
|
|||
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||
where: {
|
||||
posLevel: {
|
||||
posLevelName:Like(`%${body.keyword}%`)
|
||||
posLevelName: Like(`%${body.keyword}%`),
|
||||
},
|
||||
current_holders: {
|
||||
orgRevisionId:revision?.id
|
||||
}
|
||||
orgRevisionId: revision?.id,
|
||||
},
|
||||
},
|
||||
relations: [
|
||||
"posType",
|
||||
|
|
@ -6174,9 +6181,10 @@ export class ProfileController extends Controller {
|
|||
current_holders: {
|
||||
orgRevisionId: revision?.id,
|
||||
orgRoot: {
|
||||
orgRootName:Like(`%${body.keyword}%`)
|
||||
}
|
||||
}},
|
||||
orgRootName: Like(`%${body.keyword}%`),
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: [
|
||||
"posType",
|
||||
"posLevel",
|
||||
|
|
@ -6197,8 +6205,8 @@ export class ProfileController extends Controller {
|
|||
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||
where: {
|
||||
current_holders: {
|
||||
orgRevisionId:revision?.id
|
||||
}
|
||||
orgRevisionId: revision?.id,
|
||||
},
|
||||
},
|
||||
relations: [
|
||||
"posType",
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
: "-",
|
||||
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||
educations: Education,
|
||||
url: ImgUrl ? ImgUrl : `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
|
||||
url: ImgUrl ? ImgUrl : `${process.env.VITE_URL_SSO}/assets/avatar_user-89f22423.jpg`,
|
||||
};
|
||||
|
||||
return new HttpSuccess({
|
||||
|
|
@ -722,7 +722,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
: "",
|
||||
telephone:
|
||||
profiles.telephoneNumber != null ? Extension.ToThaiNumber(profiles.telephoneNumber) : "",
|
||||
url: ImgUrl ? ImgUrl : `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
|
||||
url: ImgUrl ? ImgUrl : `${process.env.VITE_URL_SSO}/assets/avatar_user-89f22423.jpg`,
|
||||
url1: _ImgUrl[0] ? _ImgUrl[0] : null,
|
||||
yearUpload1: profiles.profileAvatars[0]
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[0].createdAt))
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
: "-",
|
||||
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||
educations: Education,
|
||||
url: ImgUrl ? ImgUrl : `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
|
||||
url: ImgUrl ? ImgUrl : `${process.env.VITE_URL_SSO}/assets/avatar_user-89f22423.jpg`,
|
||||
};
|
||||
|
||||
return new HttpSuccess({
|
||||
|
|
@ -719,7 +719,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
: "",
|
||||
telephone:
|
||||
profiles.telephoneNumber != null ? Extension.ToThaiNumber(profiles.telephoneNumber) : "",
|
||||
url: ImgUrl ? ImgUrl : `https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg`,
|
||||
url: ImgUrl ? ImgUrl : `${process.env.VITE_URL_SSO}/assets/avatar_user-89f22423.jpg`,
|
||||
url1: _ImgUrl[0] ? _ImgUrl[0] : null,
|
||||
yearUpload1: profiles.profileAvatars[0]
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortYear(profiles.profileAvatars[0].createdAt))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue