Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature](shared api): update sqle api file #34

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions packages/shared/lib/api/sqle/service/SqlManage/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import {
GetSqlManageListFilterSourceEnum,
GetSqlManageListFilterAuditLevelEnum,
GetSqlManageListFilterStatusEnum,
exportSqlManageV1FilterSourceEnum,
exportSqlManageV1FilterAuditLevelEnum,
exportSqlManageV1FilterStatusEnum
} from './index.enum';

import {
IGetSqlManageListResp,
IBatchUpdateSqlManageReq,
IBaseRes
} from '../common.d';

export interface IGetSqlManageListParams {
project_name: string;

fuzzy_search_sql_fingerprint?: string;

filter_assignee?: string;

filter_instance_name?: string;

filter_source?: GetSqlManageListFilterSourceEnum;

filter_audit_level?: GetSqlManageListFilterAuditLevelEnum;

filter_last_audit_start_time_from?: string;

filter_last_audit_start_time_to?: string;

filter_status?: GetSqlManageListFilterStatusEnum;

page_index: number;

page_size: number;
}

export interface IGetSqlManageListReturn extends IGetSqlManageListResp {}

export interface IBatchUpdateSqlManageParams extends IBatchUpdateSqlManageReq {
project_name: string;
}

export interface IBatchUpdateSqlManageReturn extends IBaseRes {}

export interface IExportSqlManageV1Params {
project_name: string;

fuzzy_search_sql_fingerprint?: string;

filter_assignee?: string;

filter_instance_name?: string;

filter_source?: exportSqlManageV1FilterSourceEnum;

filter_audit_level?: exportSqlManageV1FilterAuditLevelEnum;

filter_last_audit_start_time_from?: string;

filter_last_audit_start_time_to?: string;

filter_status?: exportSqlManageV1FilterStatusEnum;
}
53 changes: 53 additions & 0 deletions packages/shared/lib/api/sqle/service/SqlManage/index.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* tslint:disable no-duplicate-string */

export enum GetSqlManageListFilterSourceEnum {
'audit_plan' = 'audit_plan',

'sql_audit_record' = 'sql_audit_record'
}

export enum GetSqlManageListFilterAuditLevelEnum {
'normal' = 'normal',

'notice' = 'notice',

'warn' = 'warn',

'error' = 'error'
}

export enum GetSqlManageListFilterStatusEnum {
'unhandled' = 'unhandled',

'solved' = 'solved',

'ignored' = 'ignored',

'manual_audited' = 'manual_audited'
}

export enum exportSqlManageV1FilterSourceEnum {
'audit_plan' = 'audit_plan',

'sql_audit_record' = 'sql_audit_record'
}

export enum exportSqlManageV1FilterAuditLevelEnum {
'normal' = 'normal',

'notice' = 'notice',

'warn' = 'warn',

'error' = 'error'
}

export enum exportSqlManageV1FilterStatusEnum {
'unhandled' = 'unhandled',

'solved' = 'solved',

'ignored' = 'ignored',

'manual_audited' = 'manual_audited'
}
64 changes: 64 additions & 0 deletions packages/shared/lib/api/sqle/service/SqlManage/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* tslint:disable no-identical-functions */
/* tslint:disable no-useless-cast */
/* tslint:disable no-unnecessary-type-assertion */
/* tslint:disable no-big-function */
/* tslint:disable no-duplicate-string */
import ServiceBase from '../Service.base';
import { AxiosRequestConfig } from 'axios';

import {
IGetSqlManageListParams,
IGetSqlManageListReturn,
IBatchUpdateSqlManageParams,
IBatchUpdateSqlManageReturn,
IExportSqlManageV1Params
} from './index.d';

class SqlManageService extends ServiceBase {
public GetSqlManageList(
params: IGetSqlManageListParams,
options?: AxiosRequestConfig
) {
const paramsData = this.cloneDeep(params);
const project_name = paramsData.project_name;
delete paramsData.project_name;

return this.get<IGetSqlManageListReturn>(
`/v1/projects/${project_name}/sql_manages`,
paramsData,
options
);
}

public BatchUpdateSqlManage(
params: IBatchUpdateSqlManageParams,
options?: AxiosRequestConfig
) {
const paramsData = this.cloneDeep(params);
const project_name = paramsData.project_name;
delete paramsData.project_name;

return this.patch<IBatchUpdateSqlManageReturn>(
`/v1/projects/${project_name}/sql_manages/batch`,
paramsData,
options
);
}

public exportSqlManageV1(
params: IExportSqlManageV1Params,
options?: AxiosRequestConfig
) {
const paramsData = this.cloneDeep(params);
const project_name = paramsData.project_name;
delete paramsData.project_name;

return this.get<any>(
`/v1/projects/${project_name}/sql_manages/exports`,
paramsData,
options
);
}
}

export default new SqlManageService();
8 changes: 8 additions & 0 deletions packages/shared/lib/api/sqle/service/audit_plan/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ export interface IGetAuditPlanReportV1Params {

export interface IGetAuditPlanReportV1Return extends IGetAuditPlanReportResV1 {}

export interface IExportAuditPlanReportV1Params {
project_name: string;

audit_plan_name: string;

audit_plan_report_id: string;
}

export interface IGetAuditPlanReportsSQLsV1Params {
project_name: string;

Expand Down
22 changes: 22 additions & 0 deletions packages/shared/lib/api/sqle/service/audit_plan/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
IGetAuditPlanReportsV1Return,
IGetAuditPlanReportV1Params,
IGetAuditPlanReportV1Return,
IExportAuditPlanReportV1Params,
IGetAuditPlanReportsSQLsV1Params,
IGetAuditPlanReportsSQLsV1Return,
IGetTaskAnalysisDataParams,
Expand Down Expand Up @@ -248,6 +249,27 @@ class AuditPlanService extends ServiceBase {
);
}

public exportAuditPlanReportV1(
params: IExportAuditPlanReportV1Params,
options?: AxiosRequestConfig
) {
const paramsData = this.cloneDeep(params);
const project_name = paramsData.project_name;
delete paramsData.project_name;

const audit_plan_name = paramsData.audit_plan_name;
delete paramsData.audit_plan_name;

const audit_plan_report_id = paramsData.audit_plan_report_id;
delete paramsData.audit_plan_report_id;

return this.get<any>(
`/v1/projects/${project_name}/audit_plans/${audit_plan_name}/reports/${audit_plan_report_id}/export`,
paramsData,
options
);
}

public getAuditPlanReportsSQLsV1(
params: IGetAuditPlanReportsSQLsV1Params,
options?: AxiosRequestConfig
Expand Down
Loading
Loading