Skip to content

Commit 643ccec

Browse files
Azir-11honghuangdc
authored andcommitted
refactor(types): improve namespace migration.
1 parent bf9baf0 commit 643ccec

File tree

2 files changed

+139
-175
lines changed

2 files changed

+139
-175
lines changed

src/typings/api.d.ts

Lines changed: 0 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -47,179 +47,4 @@ declare namespace Api {
4747
status: EnableStatus | null;
4848
} & T;
4949
}
50-
51-
/**
52-
* namespace Auth
53-
*
54-
* backend api module: "auth"
55-
*/
56-
namespace Auth {
57-
interface LoginToken {
58-
token: string;
59-
refreshToken: string;
60-
}
61-
62-
interface UserInfo {
63-
userId: string;
64-
userName: string;
65-
roles: string[];
66-
buttons: string[];
67-
}
68-
}
69-
70-
/**
71-
* namespace Route
72-
*
73-
* backend api module: "route"
74-
*/
75-
namespace Route {
76-
type ElegantConstRoute = import('@elegant-router/types').ElegantConstRoute;
77-
78-
interface MenuRoute extends ElegantConstRoute {
79-
id: string;
80-
}
81-
82-
interface UserRoute {
83-
routes: MenuRoute[];
84-
home: import('@elegant-router/types').LastLevelRouteKey;
85-
}
86-
}
87-
88-
/**
89-
* namespace SystemManage
90-
*
91-
* backend api module: "systemManage"
92-
*/
93-
namespace SystemManage {
94-
type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'current' | 'size'>;
95-
96-
/** role */
97-
type Role = Common.CommonRecord<{
98-
/** role name */
99-
roleName: string;
100-
/** role code */
101-
roleCode: string;
102-
/** role description */
103-
roleDesc: string;
104-
}>;
105-
106-
/** role search params */
107-
type RoleSearchParams = CommonType.RecordNullable<
108-
Pick<Api.SystemManage.Role, 'roleName' | 'roleCode' | 'status'> & CommonSearchParams
109-
>;
110-
111-
/** role list */
112-
type RoleList = Common.PaginatingQueryRecord<Role>;
113-
114-
/** all role */
115-
type AllRole = Pick<Role, 'id' | 'roleName' | 'roleCode'>;
116-
117-
/**
118-
* user gender
119-
*
120-
* - "1": "male"
121-
* - "2": "female"
122-
*/
123-
type UserGender = '1' | '2';
124-
125-
/** user */
126-
type User = Common.CommonRecord<{
127-
/** user name */
128-
userName: string;
129-
/** user gender */
130-
userGender: UserGender | null;
131-
/** user nick name */
132-
nickName: string;
133-
/** user phone */
134-
userPhone: string;
135-
/** user email */
136-
userEmail: string;
137-
/** user role code collection */
138-
userRoles: string[];
139-
}>;
140-
141-
/** user search params */
142-
type UserSearchParams = CommonType.RecordNullable<
143-
Pick<Api.SystemManage.User, 'userName' | 'userGender' | 'nickName' | 'userPhone' | 'userEmail' | 'status'> &
144-
CommonSearchParams
145-
>;
146-
147-
/** user list */
148-
type UserList = Common.PaginatingQueryRecord<User>;
149-
150-
/**
151-
* menu type
152-
*
153-
* - "1": directory
154-
* - "2": menu
155-
*/
156-
type MenuType = '1' | '2';
157-
158-
type MenuButton = {
159-
/**
160-
* button code
161-
*
162-
* it can be used to control the button permission
163-
*/
164-
code: string;
165-
/** button description */
166-
desc: string;
167-
};
168-
169-
/**
170-
* icon type
171-
*
172-
* - "1": iconify icon
173-
* - "2": local icon
174-
*/
175-
type IconType = '1' | '2';
176-
177-
type MenuPropsOfRoute = Pick<
178-
import('vue-router').RouteMeta,
179-
| 'i18nKey'
180-
| 'keepAlive'
181-
| 'constant'
182-
| 'order'
183-
| 'href'
184-
| 'hideInMenu'
185-
| 'activeMenu'
186-
| 'multiTab'
187-
| 'fixedIndexInTab'
188-
| 'query'
189-
>;
190-
191-
type Menu = Common.CommonRecord<{
192-
/** parent menu id */
193-
parentId: number;
194-
/** menu type */
195-
menuType: MenuType;
196-
/** menu name */
197-
menuName: string;
198-
/** route name */
199-
routeName: string;
200-
/** route path */
201-
routePath: string;
202-
/** component */
203-
component?: string;
204-
/** iconify icon name or local icon name */
205-
icon: string;
206-
/** icon type */
207-
iconType: IconType;
208-
/** buttons */
209-
buttons?: MenuButton[] | null;
210-
/** children menu */
211-
children?: Menu[] | null;
212-
}> &
213-
MenuPropsOfRoute;
214-
215-
/** menu list */
216-
type MenuList = Common.PaginatingQueryRecord<Menu>;
217-
218-
type MenuTree = {
219-
id: number;
220-
label: string;
221-
pId: number;
222-
children?: MenuTree[];
223-
};
224-
}
22550
}

src/typings/api/system-manage.d.ts

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
declare namespace Api {
2+
/**
3+
* namespace SystemManage
4+
*
5+
* backend api module: "systemManage"
6+
*/
7+
namespace SystemManage {
8+
type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'current' | 'size'>;
9+
10+
/** role */
11+
type Role = Common.CommonRecord<{
12+
/** role name */
13+
roleName: string;
14+
/** role code */
15+
roleCode: string;
16+
/** role description */
17+
roleDesc: string;
18+
}>;
19+
20+
/** role search params */
21+
type RoleSearchParams = CommonType.RecordNullable<
22+
Pick<Api.SystemManage.Role, 'roleName' | 'roleCode' | 'status'> & CommonSearchParams
23+
>;
24+
25+
/** role list */
26+
type RoleList = Common.PaginatingQueryRecord<Role>;
27+
28+
/** all role */
29+
type AllRole = Pick<Role, 'id' | 'roleName' | 'roleCode'>;
30+
31+
/**
32+
* user gender
33+
*
34+
* - "1": "male"
35+
* - "2": "female"
36+
*/
37+
type UserGender = '1' | '2';
38+
39+
/** user */
40+
type User = Common.CommonRecord<{
41+
/** user name */
42+
userName: string;
43+
/** user gender */
44+
userGender: UserGender | null;
45+
/** user nick name */
46+
nickName: string;
47+
/** user phone */
48+
userPhone: string;
49+
/** user email */
50+
userEmail: string;
51+
/** user role code collection */
52+
userRoles: string[];
53+
}>;
54+
55+
/** user search params */
56+
type UserSearchParams = CommonType.RecordNullable<
57+
Pick<Api.SystemManage.User, 'userName' | 'userGender' | 'nickName' | 'userPhone' | 'userEmail' | 'status'> &
58+
CommonSearchParams
59+
>;
60+
61+
/** user list */
62+
type UserList = Common.PaginatingQueryRecord<User>;
63+
64+
/**
65+
* menu type
66+
*
67+
* - "1": directory
68+
* - "2": menu
69+
*/
70+
type MenuType = '1' | '2';
71+
72+
type MenuButton = {
73+
/**
74+
* button code
75+
*
76+
* it can be used to control the button permission
77+
*/
78+
code: string;
79+
/** button description */
80+
desc: string;
81+
};
82+
83+
/**
84+
* icon type
85+
*
86+
* - "1": iconify icon
87+
* - "2": local icon
88+
*/
89+
type IconType = '1' | '2';
90+
91+
type MenuPropsOfRoute = Pick<
92+
import('vue-router').RouteMeta,
93+
| 'i18nKey'
94+
| 'keepAlive'
95+
| 'constant'
96+
| 'order'
97+
| 'href'
98+
| 'hideInMenu'
99+
| 'activeMenu'
100+
| 'multiTab'
101+
| 'fixedIndexInTab'
102+
| 'query'
103+
>;
104+
105+
type Menu = Common.CommonRecord<{
106+
/** parent menu id */
107+
parentId: number;
108+
/** menu type */
109+
menuType: MenuType;
110+
/** menu name */
111+
menuName: string;
112+
/** route name */
113+
routeName: string;
114+
/** route path */
115+
routePath: string;
116+
/** component */
117+
component?: string;
118+
/** iconify icon name or local icon name */
119+
icon: string;
120+
/** icon type */
121+
iconType: IconType;
122+
/** buttons */
123+
buttons?: MenuButton[] | null;
124+
/** children menu */
125+
children?: Menu[] | null;
126+
}> &
127+
MenuPropsOfRoute;
128+
129+
/** menu list */
130+
type MenuList = Common.PaginatingQueryRecord<Menu>;
131+
132+
type MenuTree = {
133+
id: number;
134+
label: string;
135+
pId: number;
136+
children?: MenuTree[];
137+
};
138+
}
139+
}

0 commit comments

Comments
 (0)