device.d.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. export interface Device {
  2. id?: number;
  3. clientid: string;
  4. device_name?: string;
  5. username?: string;
  6. firmware_version?: string;
  7. device_ip_port?: string;
  8. last_ip_port?: string;
  9. status?: 'online' | 'offline' | 'unknown';
  10. last_event_time?: Date;
  11. last_online_time?: Date;
  12. last_offline_time?: Date;
  13. online_duration?: number;
  14. connect_count?: number;
  15. rssi?: number;
  16. created_at?: Date;
  17. updated_at?: Date;
  18. }
  19. export declare class DeviceModel {
  20. static getAll(limit?: number, offset?: number): Promise<Device[]>;
  21. static getByStatus(status: string): Promise<Device[]>;
  22. static getByClientId(clientid: string): Promise<Device | null>;
  23. static getBySearch(searchTerm: string): Promise<Device[]>;
  24. static getCountByStatus(status: string): Promise<number>;
  25. static getCountBySearch(searchTerm: string): Promise<number>;
  26. static getCount(): Promise<number>;
  27. static getStatusStats(): Promise<any[]>;
  28. static getDeviceStats(): Promise<any>;
  29. static create(deviceData: Omit<Device, 'id' | 'created_at' | 'updated_at'>): Promise<Device>;
  30. static update(clientId: string, updateData: Partial<Omit<Device, 'id' | 'created_at' | 'clientid'>>): Promise<boolean>;
  31. static updateOnlineDuration(clientId: string, duration: number): Promise<boolean>;
  32. static deleteByClientId(clientId: string): Promise<boolean>;
  33. }
  34. //# sourceMappingURL=device.d.ts.map