@spytecgps/nova-orm 1.0.36 → 1.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/repositories/deviceStatus/getDeviceStatusesCount.d.ts +4 -0
- package/dist/repositories/deviceStatus/getDeviceStatusesCount.js +37 -0
- package/dist/repositories/deviceStatus/getDeviceStatusesCount.js.map +1 -0
- package/dist/repositories/deviceStatus/index.d.ts +10 -1
- package/dist/repositories/deviceStatus/index.js +16 -0
- package/dist/repositories/deviceStatus/index.js.map +1 -1
- package/dist/repositories/liveLinks/getLiveLinkDataCount.d.ts +5 -0
- package/dist/repositories/liveLinks/getLiveLinkDataCount.js +39 -0
- package/dist/repositories/liveLinks/getLiveLinkDataCount.js.map +1 -0
- package/dist/repositories/liveLinks/index.d.ts +20 -1
- package/dist/repositories/liveLinks/index.js +27 -0
- package/dist/repositories/liveLinks/index.js.map +1 -1
- package/dist/types/deviceStatus.d.ts +8 -0
- package/dist/types/liveLinks.d.ts +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { NovaDataSource } from '../../novaDataSource';
|
|
2
|
+
import { GetDeviceStatusesCountParams } from '../../types/deviceStatus';
|
|
3
|
+
import { Logger } from '../../types/logger';
|
|
4
|
+
export declare const getDeviceStatusesCount: (novaDataSource: NovaDataSource, params: GetDeviceStatusesCountParams, logger: Logger) => Promise<number>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Device } from '../../entities';
|
|
2
|
+
import { DeviceStatus } from '../../entities/deviceStatus';
|
|
3
|
+
export const getDeviceStatusesCount = async (novaDataSource, params, logger) => {
|
|
4
|
+
if (!params?.filters?.imeiList?.length && !params?.filters?.clientId) {
|
|
5
|
+
logger.warn({ params }, 'DeviceStatusRepository::getDeviceStatusesCount missing required parameters');
|
|
6
|
+
return 0;
|
|
7
|
+
}
|
|
8
|
+
return novaDataSource.safeQuery(async (dataSource) => {
|
|
9
|
+
const deviceStatusRepository = dataSource.getRepository(DeviceStatus);
|
|
10
|
+
let queryBuilder = deviceStatusRepository.createQueryBuilder('deviceStatus');
|
|
11
|
+
if (params.filters.imeiList?.length) {
|
|
12
|
+
queryBuilder = queryBuilder.andWhere('deviceStatus.imei IN (:...imeis)', {
|
|
13
|
+
imeis: params.filters.imeiList,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
if (params.filters.clientId) {
|
|
17
|
+
queryBuilder = queryBuilder.andWhere('deviceStatus.clientId = :clientId', {
|
|
18
|
+
clientId: params.filters.clientId,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (params.filters.minSendTime) {
|
|
22
|
+
queryBuilder = queryBuilder.andWhere('deviceStatus.sendTime > :sendTimeMin', {
|
|
23
|
+
sendTimeMin: params.filters.minSendTime,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (params.filters.deviceStatus) {
|
|
27
|
+
queryBuilder = queryBuilder
|
|
28
|
+
.leftJoin(Device, 'device', 'deviceStatus.imei = device.imei and deviceStatus.clientId = device.clientId')
|
|
29
|
+
.andWhere('device.status = :status', {
|
|
30
|
+
status: params.filters.deviceStatus,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const result = await queryBuilder.getCount();
|
|
34
|
+
return result;
|
|
35
|
+
}, 'DeviceStatusRepository::getDeviceStatusesCount');
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=getDeviceStatusesCount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDeviceStatusesCount.js","sourceRoot":"","sources":["../../../src/repositories/deviceStatus/getDeviceStatusesCount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAK1D,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACzC,cAA8B,EAC9B,M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A;SACL;QAED,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,QAAQ,EAAE,CAAA;QAE5C,OAAO,MAAM,CAAA;IACf,CAAC,EAAE,gDAAgD,CAAC,CAAA;AACtD,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DeviceStatus } from '../../entities/deviceStatus';
|
|
2
|
-
import { GetDeviceStatusesParams, UpsertDeviceStatusesParams } from '../../types/deviceStatus';
|
|
2
|
+
import { GetDeviceStatusesCountParams, GetDeviceStatusesParams, UpsertDeviceStatusesParams } from '../../types/deviceStatus';
|
|
3
3
|
import { BaseRepository } from './../baseRepository';
|
|
4
4
|
export declare class DeviceStatusRepository extends BaseRepository {
|
|
5
5
|
/**
|
|
@@ -18,6 +18,15 @@ export declare class DeviceStatusRepository extends BaseRepository {
|
|
|
18
18
|
* - projectionOptions.clientDeviceSettingsProperties: The client device settings properties to get
|
|
19
19
|
*/
|
|
20
20
|
getDeviceStatuses(params: GetDeviceStatusesParams): Promise<DeviceStatus[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Get total count of device statuses based on the filters
|
|
23
|
+
* @param {GetDeviceStatusesCountParams} params containing information to get device statuses count
|
|
24
|
+
* - filters.deviceStatus: The device status
|
|
25
|
+
* - filters.clientId: The client id
|
|
26
|
+
* - filters.imeiList: The imei list
|
|
27
|
+
* - filters.minSendTime: The min send time
|
|
28
|
+
*/
|
|
29
|
+
getDeviceStatusesCount(params: GetDeviceStatusesCountParams): Promise<number>;
|
|
21
30
|
/**
|
|
22
31
|
* Upsert the device status information
|
|
23
32
|
* @param {UpsertDeviceStatusesParams} params containing device statuses information
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NovaDataSource } from '../../novaDataSource';
|
|
2
2
|
import { BaseRepository } from './../baseRepository';
|
|
3
3
|
import { getDeviceStatuses } from './getDeviceStatuses';
|
|
4
|
+
import { getDeviceStatusesCount } from './getDeviceStatusesCount';
|
|
4
5
|
import { upsertDeviceStatuses } from './upsertDeviceStatuses';
|
|
5
6
|
export class DeviceStatusRepository extends BaseRepository {
|
|
6
7
|
/**
|
|
@@ -25,6 +26,21 @@ export class DeviceStatusRepository extends BaseRepository {
|
|
|
25
26
|
this.logger.trace(result, 'DeviceStatusRepository::getDeviceStatus result');
|
|
26
27
|
return result;
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Get total count of device statuses based on the filters
|
|
31
|
+
* @param {GetDeviceStatusesCountParams} params containing information to get device statuses count
|
|
32
|
+
* - filters.deviceStatus: The device status
|
|
33
|
+
* - filters.clientId: The client id
|
|
34
|
+
* - filters.imeiList: The imei list
|
|
35
|
+
* - filters.minSendTime: The min send time
|
|
36
|
+
*/
|
|
37
|
+
async getDeviceStatusesCount(params) {
|
|
38
|
+
this.logger.trace(params, 'DeviceStatusRepository::getDeviceStatusesCount started with params');
|
|
39
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
40
|
+
const result = await getDeviceStatusesCount(novaDataSource, params, this.logger);
|
|
41
|
+
this.logger.trace({ result }, 'DeviceStatusRepository::getDeviceStatusesCount result');
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
28
44
|
/**
|
|
29
45
|
* Upsert the device status information
|
|
30
46
|
* @param {UpsertDeviceStatusesParams} params containing device statuses information
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/repositories/deviceStatus/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/repositories/deviceStatus/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAMrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,sBA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AAI,CAAC,MAAM,CAAC,CAAA;QAEjF,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QAE9E,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,mDAAmD,CAAC,CAAA;QAElF,OAAO,MAAM,CAAA;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NovaDataSource } from '../../novaDataSource';
|
|
2
|
+
import { GetLiveLinkDataCountParams } from '../../types/liveLinks';
|
|
3
|
+
import { Logger } from '../../types/logger';
|
|
4
|
+
import { DeviceStatusRepository } from '../deviceStatus';
|
|
5
|
+
export declare const getLiveLinkDataCount: (novaDataSource: NovaDataSource, params: GetLiveLinkDataCountParams, logger: Logger, deviceStatusRepository: DeviceStatusRepository) => Promise<number>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LiveLink } from '../../entities/liveLink';
|
|
2
|
+
import { Enums } from '../../types';
|
|
3
|
+
import { uuidStringToBinaryBuffer } from '../../utils/uuidHelpers';
|
|
4
|
+
export const getLiveLinkDataCount = async (novaDataSource, params, logger, deviceStatusRepository) => {
|
|
5
|
+
if (!params?.filters?.id || !params?.filters?.clientId) {
|
|
6
|
+
logger.warn({ params }, 'LiveLinksRepository::getLiveLinkDataCount - missing required parameters');
|
|
7
|
+
return 0;
|
|
8
|
+
}
|
|
9
|
+
const binaryBuffer = uuidStringToBinaryBuffer(params?.filters?.id);
|
|
10
|
+
if (!binaryBuffer?.length) {
|
|
11
|
+
logger.warn({ params }, 'LiveLinksRepository::getLiveLinkDataCount - id should be a valid UUID');
|
|
12
|
+
return 0;
|
|
13
|
+
}
|
|
14
|
+
return novaDataSource.safeQuery(async (dataSource) => {
|
|
15
|
+
const liveLinksRepository = dataSource.getRepository(LiveLink);
|
|
16
|
+
const queryBuilder = liveLinksRepository
|
|
17
|
+
.createQueryBuilder('liveLink')
|
|
18
|
+
.andWhere('id = :id', { id: binaryBuffer })
|
|
19
|
+
.andWhere('clientId = :clientId', { clientId: params.filters.clientId });
|
|
20
|
+
const liveLink = await queryBuilder.getOne();
|
|
21
|
+
if (!liveLink) {
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
const devices = liveLink.devices;
|
|
25
|
+
if (liveLink.deviceAccess === 'limited' && !devices?.length) {
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
const filters = liveLink.deviceAccess === 'limited' ? { imeiList: devices } : { clientId: liveLink.clientId };
|
|
29
|
+
const result = await deviceStatusRepository.getDeviceStatusesCount({
|
|
30
|
+
filters: {
|
|
31
|
+
...filters,
|
|
32
|
+
minSendTime: params.filters.minSendTime,
|
|
33
|
+
deviceStatus: Enums.DeviceStatus.Active,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
return result;
|
|
37
|
+
}, 'LiveLinksRepository::getLiveLinkDataCount');
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=getLiveLinkDataCount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLiveLinkDataCount.js","sourceRoot":"","sources":["../../../src/repositories/liveLinks/getLiveLinkDataCount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAElD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAGnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAGlE,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EACvC,cAA8B,EAC9B,MAAkC,EAClC,MAAc,EACd,sBAA8C,EAC7B,EAAE;IACnB,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE;QACtD,MAAM,CAAC,IAAI,CACT,EAAE,MAAM,EAAE,EACV,yEAAyE,CAC1E,CAAA;QAC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YAAY,EAAE,KAAK,CAAC,YAAY,CAAC,MAAM;aACxC;SACF,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC,EAAE,2CAA2C,CAAC,CAAA;AACjD,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LiveLink } from '../../entities';
|
|
2
|
-
import { CreateLiveLinkParams, GetLiveLinkDataParams, GetLiveLinksCountParams, GetLiveLinksParams, LiveLinkData, UpdateLiveLinkParams } from '../../types/liveLinks';
|
|
2
|
+
import { CreateLiveLinkParams, GetLiveLinkDataCountParams, GetLiveLinkDataParams, GetLiveLinksCountParams, GetLiveLinksParams, LiveLinkData, UpdateLiveLinkParams } from '../../types/liveLinks';
|
|
3
3
|
import { BaseRepository } from '../baseRepository';
|
|
4
4
|
export declare class LiveLinksRepository extends BaseRepository {
|
|
5
5
|
/**
|
|
@@ -51,5 +51,24 @@ export declare class LiveLinksRepository extends BaseRepository {
|
|
|
51
51
|
* @returns The live links count
|
|
52
52
|
*/
|
|
53
53
|
getLiveLinksCount(params: GetLiveLinksCountParams): Promise<number>;
|
|
54
|
+
/**
|
|
55
|
+
* Get trackers with location data associated with a live link
|
|
56
|
+
* @param params - The parameters to get live link data
|
|
57
|
+
* filters.id: the liveLink id, required. It should be a valid UUID.
|
|
58
|
+
* filters.clientId: the client id, required
|
|
59
|
+
* filters.minSendTime: the min send time, optional
|
|
60
|
+
* pagingOptions.pageSize: the page size, optional. Default: 100
|
|
61
|
+
* pagingOptions.pageIndex: the page index, optional. Default: 0
|
|
62
|
+
* @returns The live link data
|
|
63
|
+
*/
|
|
54
64
|
getLiveLinkData(params: GetLiveLinkDataParams): Promise<LiveLinkData>;
|
|
65
|
+
/**
|
|
66
|
+
* Get total count of trackers with location data associated with a live link
|
|
67
|
+
* @param params - The parameters to get live link data count
|
|
68
|
+
* filters.id: the liveLink id, required. It should be a valid UUID.
|
|
69
|
+
* filters.clientId: the client id, required
|
|
70
|
+
* filters.minSendTime: the min send time, optional
|
|
71
|
+
* @returns The live link data count
|
|
72
|
+
*/
|
|
73
|
+
getLiveLinkDataCount(params: GetLiveLinkDataCountParams): Promise<number>;
|
|
55
74
|
}
|
|
@@ -3,6 +3,7 @@ import { BaseRepository } from '../baseRepository';
|
|
|
3
3
|
import { DeviceStatusRepository } from '../deviceStatus';
|
|
4
4
|
import { createLiveLink } from './createLiveLink';
|
|
5
5
|
import { getLiveLinkData } from './getLiveLinkData';
|
|
6
|
+
import { getLiveLinkDataCount } from './getLiveLinkDataCount';
|
|
6
7
|
import { getLiveLinks } from './getLiveLinks';
|
|
7
8
|
import { getLiveLinksCount } from './getLiveLinksCount';
|
|
8
9
|
import { updateLiveLink } from './updateLiveLink';
|
|
@@ -80,6 +81,16 @@ export class LiveLinksRepository extends BaseRepository {
|
|
|
80
81
|
this.logger.trace({ result }, 'LiveLinksRepository::getLiveLinksCount result');
|
|
81
82
|
return result;
|
|
82
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Get trackers with location data associated with a live link
|
|
86
|
+
* @param params - The parameters to get live link data
|
|
87
|
+
* filters.id: the liveLink id, required. It should be a valid UUID.
|
|
88
|
+
* filters.clientId: the client id, required
|
|
89
|
+
* filters.minSendTime: the min send time, optional
|
|
90
|
+
* pagingOptions.pageSize: the page size, optional. Default: 100
|
|
91
|
+
* pagingOptions.pageIndex: the page index, optional. Default: 0
|
|
92
|
+
* @returns The live link data
|
|
93
|
+
*/
|
|
83
94
|
async getLiveLinkData(params) {
|
|
84
95
|
this.logger.trace(params, 'LiveLinksRepository::getLiveLinkData started with params');
|
|
85
96
|
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
@@ -88,5 +99,21 @@ export class LiveLinksRepository extends BaseRepository {
|
|
|
88
99
|
this.logger.trace(result, 'LiveLinksRepository::getLiveLinkData result');
|
|
89
100
|
return result;
|
|
90
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Get total count of trackers with location data associated with a live link
|
|
104
|
+
* @param params - The parameters to get live link data count
|
|
105
|
+
* filters.id: the liveLink id, required. It should be a valid UUID.
|
|
106
|
+
* filters.clientId: the client id, required
|
|
107
|
+
* filters.minSendTime: the min send time, optional
|
|
108
|
+
* @returns The live link data count
|
|
109
|
+
*/
|
|
110
|
+
async getLiveLinkDataCount(params) {
|
|
111
|
+
this.logger.trace(params, 'LiveLinksRepository::getLiveLinkDataCount started with params');
|
|
112
|
+
const novaDataSource = new NovaDataSource(this.novaDataSourceConfig, this.logger);
|
|
113
|
+
const deviceStatusRepository = new DeviceStatusRepository(this.novaDataSourceConfig, this.logger);
|
|
114
|
+
const result = await getLiveLinkDataCount(novaDataSource, params, this.logger, deviceStatusRepository);
|
|
115
|
+
this.logger.trace({ result }, 'LiveLinksRepository::getLiveLinkDataCount result');
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
91
118
|
}
|
|
92
119
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/repositories/liveLinks/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/repositories/liveLinks/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAUrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO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oB,CAAC,MAAkC;QAC3D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,+DAA+D,CAAC,CAAA;QAE1F,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QAEjF,MAAM,sBAAsB,GAAG,IAAI,sBAAsB,CACvD,IAAI,CAAC,oBAAoB,EACzB,IAAI,CAAC,MAAM,CACZ,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,oBAAoB,CACvC,cAAc,EACd,MAAM,EACN,IAAI,CAAC,MAAM,EACX,sBAAsB,CACvB,CAAA;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,kDAAkD,CAAC,CAAA;QAEjF,OAAO,MAAM,CAAA;IACf,CAAC;CACF"}
|
|
@@ -27,6 +27,14 @@ export interface GetDeviceStatusesParams {
|
|
|
27
27
|
offset?: number;
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
export interface GetDeviceStatusesCountParams {
|
|
31
|
+
filters: {
|
|
32
|
+
imeiList?: string[];
|
|
33
|
+
clientId?: number;
|
|
34
|
+
minSendTime?: Date;
|
|
35
|
+
deviceStatus?: Enums.DeviceStatus;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
30
38
|
export interface UpsertDeviceStatusesParams {
|
|
31
39
|
items: DeviceStatusEntity[];
|
|
32
40
|
}
|
|
@@ -51,6 +51,13 @@ export interface GetLiveLinkDataParams extends OptionalReportPagination {
|
|
|
51
51
|
minSendTime?: Date;
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
+
export interface GetLiveLinkDataCountParams {
|
|
55
|
+
filters: {
|
|
56
|
+
id: string;
|
|
57
|
+
clientId: number;
|
|
58
|
+
minSendTime?: Date;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
54
61
|
export interface TrackerWithLocation {
|
|
55
62
|
imei: string;
|
|
56
63
|
name: string;
|