updated api web service
This commit is contained in:
parent
537d70a8f3
commit
e0de2ed251
5 changed files with 84 additions and 3 deletions
|
|
@ -334,7 +334,8 @@ export class ApiManageController extends Controller {
|
|||
@Request() req: RequestWithUser,
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Query() searchKeyword: string = "",
|
||||
@Query() keyword: string = "",
|
||||
@Query() system: "registry" | "registry_emp" | "registry_temp" | "organization" | "" = "",
|
||||
): Promise<HttpSuccess | HttpError> {
|
||||
try {
|
||||
if (!req.user.role.includes("SUPER_ADMIN")) {
|
||||
|
|
@ -356,13 +357,17 @@ export class ApiManageController extends Controller {
|
|||
"apiName.lastUpdatedAt",
|
||||
]);
|
||||
|
||||
if (searchKeyword?.trim()) {
|
||||
if (keyword?.trim()) {
|
||||
queryBuilder.where(
|
||||
"(apiName.name LIKE :keyword OR apiName.code LIKE :keyword OR apiName.pathApi LIKE :keyword)",
|
||||
{ keyword: `%${searchKeyword.trim()}%` },
|
||||
{ keyword: `%${keyword.trim()}%` },
|
||||
);
|
||||
}
|
||||
|
||||
if (system) {
|
||||
queryBuilder.andWhere("apiName.system = :system", { system });
|
||||
}
|
||||
|
||||
const [apiNames, total] = await queryBuilder
|
||||
.skip(offset)
|
||||
.take(pageSize)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue