update: service-user/src/controllers/user.ts
This commit is contained in:
@ -204,14 +204,25 @@ export class UserController {
|
||||
filter: param.filter,
|
||||
col_any_eq: ["email"],
|
||||
col_any_like: ["User.name", "User.username"],
|
||||
additional_where: "roles.name = :doctor_role_name",
|
||||
additional_where: "roles.is_doctor = true",
|
||||
});
|
||||
// whereVal.doctor_role_name = "Doctor";
|
||||
|
||||
const res_count = userRepository.createQueryBuilder("User").leftJoin("User.roles", "roles").where(whereAttr, whereVal);
|
||||
const res_count = userRepository
|
||||
.createQueryBuilder("User")
|
||||
.leftJoin("User.roles", "roles")
|
||||
.where(whereAttr, whereVal);
|
||||
|
||||
const orderExpr = "User." + param.order_field;
|
||||
const subquery = userRepository.createQueryBuilder("User").select("User.id", "id").addSelect(orderExpr, "_list_doctor_order").leftJoin("User.roles", "roles").where(whereAttr, whereVal).orderBy(orderExpr, param.order_direction).offset(offset).limit(param.limit).distinct(true);
|
||||
const subquery = userRepository
|
||||
.createQueryBuilder("User")
|
||||
.select("User.id", "id")
|
||||
.addSelect(orderExpr, "_list_doctor_order")
|
||||
.leftJoin("User.roles", "roles")
|
||||
.where(whereAttr, whereVal)
|
||||
.orderBy(orderExpr, param.order_direction)
|
||||
.offset(offset)
|
||||
.limit(param.limit)
|
||||
.distinct(true);
|
||||
|
||||
const res_list = userRepository
|
||||
.createQueryBuilder("User")
|
||||
@ -219,7 +230,6 @@ export class UserController {
|
||||
.setParameters(subquery.getParameters())
|
||||
.leftJoinAndSelect("User.roles", "roles")
|
||||
.leftJoinAndSelect("roles.application", "application")
|
||||
.where("roles.is_doctor = :is_doctor", { is_doctor: true })
|
||||
.orderBy("User." + param.order_field, param.order_direction)
|
||||
.distinct(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user