api จัดการผู้ใช้งาน
This commit is contained in:
parent
6320f4d7db
commit
855639bd7f
6 changed files with 335 additions and 46 deletions
|
|
@ -7874,47 +7874,4 @@ export class ProfileController extends Controller {
|
|||
]);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้ไขอีเมล
|
||||
*
|
||||
* @summary แก้ไขอีเมล (USER)
|
||||
*
|
||||
*/
|
||||
@Get("keycloak/user")
|
||||
async listUserKeycloak(
|
||||
@Request() request: RequestWithUser,
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Query() keyword: string = "",
|
||||
) {
|
||||
// sort by org
|
||||
const [profiles, total] = await this.profileRepo
|
||||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.roleKeycloaks", "roleKeycloaks")
|
||||
.where("profile.citizenId LIKE :citizenId", {
|
||||
citizenId: `%${keyword}%`,
|
||||
})
|
||||
.andWhere(keyword != null && keyword != "" ? `profile.citizenId like '%${keyword}%'` : "1=1")
|
||||
.andWhere(
|
||||
keyword != null && keyword != ""
|
||||
? `CONCAT(profile.prefix, profile.firstName," ",profile.lastName) like '%${keyword}%'`
|
||||
: "1=1",
|
||||
)
|
||||
.skip((page - 1) * pageSize)
|
||||
.take(pageSize)
|
||||
.getManyAndCount();
|
||||
const _profiles = profiles.map((_data) => ({
|
||||
id: _data.id,
|
||||
firstname: _data.firstName,
|
||||
lastname: _data.lastName,
|
||||
email: _data.email,
|
||||
username: _data.citizenId,
|
||||
citizenId: _data.citizenId,
|
||||
roles: _data.roleKeycloaks,
|
||||
enabled: _data.isActive,
|
||||
}));
|
||||
|
||||
return new HttpSuccess({ data: _profiles, total });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue