Skip to content

Commit

Permalink
chore(platform): add AppDocs namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
xiejay97 committed May 31, 2023
1 parent 72ee7c6 commit a5b8703
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
4 changes: 2 additions & 2 deletions packages/platform/src/app/core/http/mock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AppNotification, AppUser, DeviceDoc } from '../../utils/types';
import type { AppNotification, AppUser } from '../../utils/types';
import type { JWTToken, JWTTokenPayload } from '../token';

import axios from 'axios';
Expand Down Expand Up @@ -47,7 +47,7 @@ if (environment.http.mock) {
list: Array.from({ length: 3 }).map((_, i) => ({ message: `This is message ${i}`, read: false })),
},
];
const deviceList = Array.from({ length: 108 }).map<DeviceDoc>((_, i) => ({
const deviceList = Array.from({ length: 108 }).map<AppDocs.Device>((_, i) => ({
id: i,
create_time: Date.now() + 60 * 60 * 1000,
update_time: Date.now() + 60 * 60 * 1000,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DeviceDoc, StandardQueryParams } from '../../../utils/types';
import type { StandardQueryParams } from '../../../utils/types';
import type { DSelectItem } from '@react-devui/ui/components/select';

import { isUndefined } from 'lodash';
Expand All @@ -17,7 +17,7 @@ import { AppDeviceModal } from './DeviceModal';

import styles from './StandardTable.module.scss';

export type DeviceData = DeviceDoc;
export type DeviceData = AppDocs.Device;

interface DeviceQueryParams {
keyword: string;
Expand Down
13 changes: 0 additions & 13 deletions packages/platform/src/app/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,4 @@ export interface StandardQueryParams {
[index: string]: any;
}

export interface StandardFields {
id: number;
create_time: number;
update_time: number;
}

export interface DeviceDoc extends StandardFields {
name: string;
model: string;
price: number;
status: number;
}

export {};
18 changes: 18 additions & 0 deletions packages/platform/src/docs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
interface StandardFields {
id: number;
create_time: number;
update_time: number;
}

declare global {
declare namespace AppDocs {
export interface Device extends StandardFields {
name: string;
model: string;
price: number;
status: number;
}
}
}

export {};

0 comments on commit a5b8703

Please sign in to comment.