fix api list filter isActive
This commit is contained in:
parent
15bc8d5088
commit
9ec19fd22b
1 changed files with 3 additions and 1 deletions
|
|
@ -337,6 +337,7 @@ export class ApiManageController extends Controller {
|
||||||
@Query("pageSize") pageSize: number = 10,
|
@Query("pageSize") pageSize: number = 10,
|
||||||
@Query() keyword: string = "",
|
@Query() keyword: string = "",
|
||||||
@Query() system: "registry" | "registry_emp" | "registry_temp" | "organization" | "" = "",
|
@Query() system: "registry" | "registry_emp" | "registry_temp" | "organization" | "" = "",
|
||||||
|
@Query() isActive: boolean = true,
|
||||||
): Promise<HttpSuccess | HttpError> {
|
): Promise<HttpSuccess | HttpError> {
|
||||||
try {
|
try {
|
||||||
if (!req.user.role.includes("SUPER_ADMIN")) {
|
if (!req.user.role.includes("SUPER_ADMIN")) {
|
||||||
|
|
@ -346,6 +347,7 @@ export class ApiManageController extends Controller {
|
||||||
|
|
||||||
const queryBuilder = AppDataSource.getRepository(ApiName)
|
const queryBuilder = AppDataSource.getRepository(ApiName)
|
||||||
.createQueryBuilder("apiName")
|
.createQueryBuilder("apiName")
|
||||||
|
.where("apiName.isActive = :isActive", { isActive: isActive ?? true })
|
||||||
.select([
|
.select([
|
||||||
"apiName.id",
|
"apiName.id",
|
||||||
"apiName.name",
|
"apiName.name",
|
||||||
|
|
@ -359,7 +361,7 @@ export class ApiManageController extends Controller {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (keyword?.trim()) {
|
if (keyword?.trim()) {
|
||||||
queryBuilder.where(
|
queryBuilder.andWhere(
|
||||||
"(apiName.name LIKE :keyword OR apiName.code LIKE :keyword OR apiName.pathApi LIKE :keyword)",
|
"(apiName.name LIKE :keyword OR apiName.code LIKE :keyword OR apiName.pathApi LIKE :keyword)",
|
||||||
{ keyword: `%${keyword.trim()}%` },
|
{ keyword: `%${keyword.trim()}%` },
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue