init: 整合项目(dashboard + www + docs)
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
declare namespace Api {
|
||||
/**
|
||||
* namespace Auth
|
||||
*
|
||||
* backend api module: "auth"
|
||||
*/
|
||||
namespace Auth {
|
||||
/** Raw login payload from dashboard backend */
|
||||
interface LoginResult {
|
||||
access_token: string;
|
||||
token_type: string;
|
||||
expires_in: number;
|
||||
user: DashboardUser;
|
||||
}
|
||||
|
||||
interface LoginToken {
|
||||
token: string;
|
||||
refreshToken: string;
|
||||
user?: DashboardUser;
|
||||
}
|
||||
|
||||
interface DashboardUser {
|
||||
id: number | string;
|
||||
username: string;
|
||||
is_super_admin: boolean;
|
||||
status?: number;
|
||||
last_login_at?: string | null;
|
||||
create_at?: string | null;
|
||||
update_at?: string | null;
|
||||
}
|
||||
|
||||
interface UserInfo {
|
||||
userId: string;
|
||||
userName: string;
|
||||
roles: string[];
|
||||
buttons: string[];
|
||||
}
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* 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 = any> extends PaginatingCommonParams {
|
||||
records: T[];
|
||||
}
|
||||
|
||||
/** common search params of table */
|
||||
type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'current' | 'size'>;
|
||||
|
||||
/**
|
||||
* enable status
|
||||
*
|
||||
* - "1": enabled
|
||||
* - "2": disabled
|
||||
*/
|
||||
type EnableStatus = '1' | '2';
|
||||
|
||||
/** common record */
|
||||
type CommonRecord<T = any> = {
|
||||
/** 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;
|
||||
}
|
||||
}
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
declare namespace Api {
|
||||
namespace Common {
|
||||
interface PageResult<T> {
|
||||
items: T[];
|
||||
total: number;
|
||||
skip: number;
|
||||
limit: number;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Brand {
|
||||
interface Brand {
|
||||
id: number;
|
||||
name: string;
|
||||
create_at?: string;
|
||||
update_at?: string;
|
||||
}
|
||||
|
||||
interface BrandPayload {
|
||||
name: string;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Dashboard {
|
||||
interface TodayStats {
|
||||
models?: Array<{
|
||||
id: number;
|
||||
brand_name?: string;
|
||||
name?: string;
|
||||
create_at?: string | null;
|
||||
}>;
|
||||
otas?: Array<{
|
||||
id: number;
|
||||
verName?: string;
|
||||
model?: string;
|
||||
create_at?: string | null;
|
||||
}>;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
interface DeviceDailySeries {
|
||||
name: string;
|
||||
data: number[];
|
||||
}
|
||||
|
||||
interface DeviceDailyStats {
|
||||
dates: string[];
|
||||
series: DeviceDailySeries[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
interface ActiveDailyStats {
|
||||
dates: string[];
|
||||
series: DeviceDailySeries[];
|
||||
latest: {
|
||||
date: string;
|
||||
total: number;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace User {
|
||||
interface User {
|
||||
id: number;
|
||||
username: string;
|
||||
is_super_admin: boolean;
|
||||
status: number;
|
||||
last_login_at?: string | null;
|
||||
create_at?: string;
|
||||
update_at?: string;
|
||||
}
|
||||
|
||||
interface CreatePayload {
|
||||
username: string;
|
||||
password: string;
|
||||
is_super_admin?: boolean;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
interface UpdatePayload {
|
||||
password?: string;
|
||||
is_super_admin?: boolean;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Ota {
|
||||
interface OtaItem {
|
||||
id: number;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Blacklist {
|
||||
interface Item {
|
||||
id: number;
|
||||
ota_id: number;
|
||||
mac: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
}
|
||||
|
||||
namespace OtaTargetDevice {
|
||||
interface Item {
|
||||
id: number;
|
||||
ota_id: number;
|
||||
mac_addr: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
}
|
||||
|
||||
namespace ShareCodeLog {
|
||||
interface Item {
|
||||
id: number;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Model {
|
||||
interface ModelItem {
|
||||
id: number;
|
||||
name?: string;
|
||||
brand_name?: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
declare namespace Api {
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user