238 lines
5.4 KiB
TypeScript
238 lines
5.4 KiB
TypeScript
/**
|
|
* Namespace Api
|
|
*
|
|
* All backend api type
|
|
*/
|
|
declare namespace Api {
|
|
namespace Common {
|
|
/** common params of paginating */
|
|
interface PaginatingCommonParams {
|
|
/** current page number */
|
|
current: number;
|
|
/** page size */
|
|
size: number;
|
|
/** total count */
|
|
total: number;
|
|
}
|
|
|
|
/** common params of paginating query list data */
|
|
interface PaginatingQueryRecord<T extends NonNullable<unknown>> extends PaginatingCommonParams {
|
|
records: T[];
|
|
}
|
|
|
|
/**
|
|
* enable status
|
|
*
|
|
* - "1": enabled
|
|
* - "2": disabled
|
|
*/
|
|
type EnableStatus = '1' | '2';
|
|
|
|
/** common record */
|
|
type CommonRecord<T extends NonNullable<unknown>> = {
|
|
/** record id */
|
|
id: number;
|
|
/** record creator */
|
|
createBy: string;
|
|
/** record create time */
|
|
createTime: string;
|
|
/** record updater */
|
|
updateBy: string;
|
|
/** record update time */
|
|
updateTime: string;
|
|
/** record status */
|
|
status: EnableStatus | null;
|
|
} & T;
|
|
}
|
|
|
|
/**
|
|
* namespace Auth
|
|
*
|
|
* backend api module: "auth"
|
|
*/
|
|
namespace Auth {
|
|
interface LoginToken {
|
|
id: string;
|
|
mode: string;
|
|
role: String;
|
|
token: string;
|
|
refreshToken: string;
|
|
createDt: string;
|
|
updateDt: string;
|
|
namespaceIds: NamespaceId[];
|
|
}
|
|
|
|
interface UserInfo {
|
|
id: string;
|
|
mode: string;
|
|
username: string;
|
|
role: string;
|
|
namespaceIds: NamespaceId[];
|
|
}
|
|
|
|
interface NamespaceId {
|
|
id: string;
|
|
name: string;
|
|
uniqueId: string;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* namespace Route
|
|
*
|
|
* backend api module: "route"
|
|
*/
|
|
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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* namespace SystemManage
|
|
*
|
|
* backend api module: "systemManage"
|
|
*/
|
|
namespace SystemManage {
|
|
type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'current' | 'size'>;
|
|
|
|
/** role */
|
|
type Role = Common.CommonRecord<{
|
|
/** 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<{
|
|
/** 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[];
|
|
}>;
|
|
}
|
|
}
|