gtsoft-snail-job-admin/src/typings/api.d.ts

398 lines
8.7 KiB
TypeScript
Raw Normal View History

2024-03-08 17:59:45 +08:00
/**
* Namespace Api
*
* All backend api type
*/
declare namespace Api {
2024-03-21 10:57:53 +08:00
namespace Common {
/** common params of paginating */
interface PaginatingCommonParams {
/** page size */
size: number;
/** total count */
total: number;
2024-03-30 17:07:04 +08:00
/** current page number */
page: number;
2024-03-21 10:57:53 +08:00
}
/** common params of paginating query list data */
2024-03-26 11:47:11 +08:00
interface PaginatingQueryRecord<T = any> extends PaginatingCommonParams {
2024-03-30 17:07:04 +08:00
data: T[];
status: number;
2024-03-21 10:57:53 +08:00
}
2024-03-30 17:07:04 +08:00
/** common page record */
type CommonPageRecord<T> = {
data: T[];
page: number;
size: number;
status: number;
total: number;
};
2024-03-21 10:57:53 +08:00
/**
* enable status
*
* - "1": enabled
* - "2": disabled
*/
type EnableStatus = '1' | '2';
/** common record */
2024-03-26 11:47:11 +08:00
type CommonRecord<T = any> = {
2024-03-21 10:57:53 +08:00
/** record id */
2024-03-30 17:07:04 +08:00
id?: number;
2024-03-21 10:57:53 +08:00
/** record creator */
2024-03-30 17:07:04 +08:00
createBy?: string;
2024-03-21 10:57:53 +08:00
/** record create time */
2024-03-30 17:07:04 +08:00
createTime?: string;
2024-03-21 10:57:53 +08:00
/** record updater */
2024-03-30 17:07:04 +08:00
updateBy?: string;
2024-03-21 10:57:53 +08:00
/** record update time */
2024-03-30 17:07:04 +08:00
updateTime?: string;
2024-03-21 10:57:53 +08:00
/** record status */
2024-03-30 17:07:04 +08:00
status?: EnableStatus | null;
2024-03-21 10:57:53 +08:00
} & T;
}
2024-03-08 17:59:45 +08:00
/**
2024-03-21 10:57:53 +08:00
* namespace Auth
2024-03-08 17:59:45 +08:00
*
2024-03-21 10:57:53 +08:00
* backend api module: "auth"
2024-03-08 17:59:45 +08:00
*/
namespace Auth {
interface LoginToken {
id: string;
mode: string;
role: String;
2024-03-08 17:59:45 +08:00
token: string;
refreshToken: string;
createDt: string;
updateDt: string;
namespaceIds: NamespaceId[];
2024-03-08 17:59:45 +08:00
}
interface UserInfo {
2024-03-26 11:47:11 +08:00
userId: string;
username: string;
2024-03-26 11:47:11 +08:00
userName: string;
mode: string;
role: string;
2024-03-26 11:47:11 +08:00
roles: string[];
buttons: string[];
namespaceIds: NamespaceId[];
}
interface NamespaceId {
id: string;
name: string;
uniqueId: string;
2024-03-08 17:59:45 +08:00
}
}
/**
2024-03-21 10:57:53 +08:00
* namespace Route
2024-03-08 17:59:45 +08:00
*
2024-03-21 10:57:53 +08:00
* backend api module: "route"
2024-03-08 17:59:45 +08:00
*/
namespace Route {
type ElegantConstRoute = import('@elegant-router/types').ElegantConstRoute;
interface MenuRoute extends ElegantConstRoute {
id: string;
}
interface UserRoute {
routes: MenuRoute[];
home: import('@elegant-router/types').LastLevelRouteKey;
}
}
2024-03-21 10:57:53 +08:00
2024-03-22 11:22:07 +08:00
/**
* namespace Dashboard
*
* backend api module: "dashboard"
*/
namespace Dashboard {
2024-03-30 17:07:04 +08:00
type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'page' | 'size'>;
2024-03-28 16:22:18 +08:00
/** Task Retry Job */
2024-03-22 11:22:07 +08:00
type CardCount = {
jobTask: JobTask;
retryTask: RetryTask;
retryTaskBarList: RetryTaskBarList[];
onLineService: OnlineService;
};
type OnlineService = {
total: number;
clientTotal: number;
serverTotal: number;
};
type RetryTaskBarList = {
2024-03-28 16:22:18 +08:00
x?: string;
taskTotal?: number;
2024-03-22 11:22:07 +08:00
};
type RetryTask = {
totalNum: number;
runningNum: number;
finishNum: number;
maxCountNum: number;
suspendNum: number;
};
type JobTask = {
successNum: number;
failNum: number;
cancelNum: number;
stopNum: number;
totalNum: number;
successRate: number;
};
2024-03-28 16:22:18 +08:00
/** Dashboard Line */
type DashboardLine = {
taskList: TaskList;
rankList: RankList[];
dashboardLineResponseDOList: DashboardLineResponseDOList[];
};
type DashboardLineResponseDOList = {
createDt: string;
total: number;
} & DashboardLineJob &
DashboardLineRetry;
type DashboardLineJob = {
createDt: string;
total: number;
fail: number;
stop: number;
cancel: number;
success: number;
};
type DashboardLineRetry = {
createDt: string;
total: number;
successNum: number;
runningNum: number;
maxCountNum: number;
suspendNum: number;
};
type RankList = {
name: string;
total: string;
};
type TaskList = {
status: number;
data: Datum[];
page: number;
size: number;
total: number;
};
type Datum = {
groupName: string;
run: number;
total: number;
};
type DashboardLineType = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | 'OTHERS';
type DashboardLineParams = {
groupName?: string;
type: DashboardLineType;
startTime?: string;
endTime?: string;
};
2024-03-30 17:07:04 +08:00
type DashboardPodsType = 1 | 2;
type DashboardPodList = Common.PaginatingQueryRecord<DashboardPod>;
type DashboardPod = {
/** 路径/组 */
consumerBuckets: number[];
/** context path */
contextPath: string;
/** 创建时间 */
createDt: string;
/** ext attrs */
extAttrs: string;
/** 组名称 */
groupName: string;
/** host id */
hostId: string;
/** host IP */
hostIp: string;
/** host port */
hostPort: string;
/** 类型 */
nodeType: DashboardPodsType;
/** 更新时间 */
updateDt: string;
};
type DashboardPodsParams = CommonType.RecordNullable<
Pick<Api.Dashboard.DashboardPod, 'groupName'> & CommonSearchParams
>;
2024-03-22 11:22:07 +08:00
}
2024-03-21 10:57:53 +08:00
/**
* namespace SystemManage
*
* backend api module: "systemManage"
*/
namespace SystemManage {
2024-03-30 17:07:04 +08:00
type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'page' | 'size'>;
2024-03-21 10:57:53 +08:00
/** role */
type Role = Common.CommonRecord<{
2024-03-30 17:07:04 +08:00
id: number;
2024-03-21 10:57:53 +08:00
/** role name */
roleName: string;
/** role code */
roleCode: string;
/** role description */
roleDesc: string;
}>;
/** role search params */
type RoleSearchParams = CommonType.RecordNullable<
Pick<Api.SystemManage.Role, 'roleName' | 'roleCode' | 'status'> & CommonSearchParams
>;
/** role list */
type RoleList = Common.PaginatingQueryRecord<Role>;
/** all role */
type AllRole = Pick<Role, 'id' | 'roleName' | 'roleCode'>;
/**
* user gender
*
* - "1": "male"
* - "2": "female"
*/
type UserGender = '1' | '2';
/** user */
type User = Common.CommonRecord<{
/** user name */
userName: string;
/** user gender */
userGender: UserGender | null;
/** user nick name */
nickName: string;
/** user phone */
userPhone: string;
/** user email */
userEmail: string;
/** user role code collection */
userRoles: string[];
}>;
/** user search params */
type UserSearchParams = CommonType.RecordNullable<
Pick<Api.SystemManage.User, 'userName' | 'userGender' | 'nickName' | 'userPhone' | 'userEmail' | 'status'> &
CommonSearchParams
>;
/** user list */
type UserList = Common.PaginatingQueryRecord<User>;
/**
* menu type
*
* - "1": directory
* - "2": menu
*/
type MenuType = '1' | '2';
type MenuButton = {
/**
* button code
*
* it can be used to control the button permission
*/
code: string;
/** button description */
desc: string;
};
/**
* icon type
*
* - "1": iconify icon
* - "2": local icon
*/
type IconType = '1' | '2';
type Menu = Common.CommonRecord<{
2024-03-30 17:07:04 +08:00
id: number;
2024-03-21 10:57:53 +08:00
/** parent menu id */
parentId: number;
/** menu type */
menuType: MenuType;
/** menu name */
menuName: string;
/** route name */
routeName: string;
/** route path */
routePath: string;
/** component */
component?: string;
/**
* i18n key
*
* it is for internationalization
*/
i18nKey?: App.I18n.I18nKey;
/** iconify icon name or local icon name */
icon: string;
/** icon type */
iconType: IconType;
/** menu order */
order: number;
/** whether to cache the route */
keepAlive?: boolean;
/** outer link */
href?: string;
/** whether to hide the route in the menu */
hideInMenu?: boolean;
/**
* The menu key will be activated when entering the route
*
* The route is not in the menu
*
* @example
* the route is "user_detail", if it is set to "user_list", the menu "user_list" will be activated
*/
activeMenu?: import('@elegant-router/types').LastLevelRouteKey;
/** By default, the same route path will use one tab, if set to true, it will use multiple tabs */
multiTab?: boolean;
/** If set, the route will be fixed in tabs, and the value is the order of fixed tabs */
fixedIndexInTab?: number;
/** menu buttons */
buttons?: MenuButton[];
/** children menu */
children?: Menu[];
}>;
2024-03-26 11:47:11 +08:00
/** menu list */
type MenuList = Common.PaginatingQueryRecord<Menu>;
type MenuTree = {
id: number;
label: string;
pId: number;
children?: MenuTree[];
};
2024-03-21 10:57:53 +08:00
}
2024-03-08 17:59:45 +08:00
}