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() keyword: string = "",
|
||||
@Query() system: "registry" | "registry_emp" | "registry_temp" | "organization" | "" = "",
|
||||
@Query() isActive: boolean = true,
|
||||
): Promise<HttpSuccess | HttpError> {
|
||||
try {
|
||||
if (!req.user.role.includes("SUPER_ADMIN")) {
|
||||
|
|
@ -346,6 +347,7 @@ export class ApiManageController extends Controller {
|
|||
|
||||
const queryBuilder = AppDataSource.getRepository(ApiName)
|
||||
.createQueryBuilder("apiName")
|
||||
.where("apiName.isActive = :isActive", { isActive: isActive ?? true })
|
||||
.select([
|
||||
"apiName.id",
|
||||
"apiName.name",
|
||||
|
|
@ -359,7 +361,7 @@ export class ApiManageController extends Controller {
|
|||
]);
|
||||
|
||||
if (keyword?.trim()) {
|
||||
queryBuilder.where(
|
||||
queryBuilder.andWhere(
|
||||
"(apiName.name LIKE :keyword OR apiName.code LIKE :keyword OR apiName.pathApi LIKE :keyword)",
|
||||
{ keyword: `%${keyword.trim()}%` },
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue