@spytecgps/nova-orm 0.0.120 → 0.0.122

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.
@@ -1,5 +1,5 @@
1
1
  import { Boundary } from '../../entities';
2
- import { BoundariesReportEntity, CreateBoundaryParams, DeleteBoundaryParams, GetBoundariesByClientIdParams, GetBoundariesReportParams, GetBoundaryByIdParams, UpdateBoundaryParams } from '../../types/boundaries';
2
+ import { BoundariesReportEntity, CreateBoundaryParams, DeleteBoundaryParams, GetBoundariesByClientIdParams, GetBoundariesReportParams, GetBoundaryByIdParams, UpdateBoundaryParams, UpsertBoundaryEventParams } from '../../types/boundaries';
3
3
  import { BaseRepository } from '../baseRepository';
4
4
  export declare class BoundariesRepository extends BaseRepository {
5
5
  /**
@@ -82,4 +82,11 @@ export declare class BoundariesRepository extends BaseRepository {
82
82
  * @returns The boundaries report
83
83
  */
84
84
  getBoundariesReport(params: GetBoundariesReportParams): Promise<BoundariesReportEntity[]>;
85
+ /**
86
+ * Upsert boundary event
87
+ * @param {UpsertBoundaryEventParams} params containing information to upsert boundary event
88
+ * - id: The id of the boundary event
89
+ * @returns true if the event was upserted, false otherwise
90
+ */
91
+ upsertBoundaryEvent(params: UpsertBoundaryEventParams): Promise<boolean>;
85
92
  }
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { UpsertBoundaryEventParams } from '../../types/boundaries';
3
+ import { Logger } from '../../types/logger';
4
+ export declare const upsertBoundaryEvent: (novaDataSource: NovaDataSource, params: UpsertBoundaryEventParams, logger: Logger) => Promise<boolean>;
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { Logger } from '../../types/logger';
3
+ import { GetTripsParams, GetTripsResult } from '../../types/trip';
4
+ export declare const getTrips: (novaDataSource: NovaDataSource, params: GetTripsParams, logger: Logger) => Promise<GetTripsResult>;
@@ -1,5 +1,5 @@
1
1
  import { Trip } from '../../entities';
2
- import { CreateTripParams, UpdateTripEndValuesParams } from '../../types/trip';
2
+ import { CreateTripParams, GetTripsParams, GetTripsResult, UpdateTripEndValuesParams } from '../../types/trip';
3
3
  import { BaseRepository } from '../baseRepository';
4
4
  export declare class TripRepository extends BaseRepository {
5
5
  /**
@@ -20,4 +20,10 @@ export declare class TripRepository extends BaseRepository {
20
20
  * @returns {Trip} the Trip associated to the passed id or null
21
21
  */
22
22
  getTripById(id: string): Promise<Trip>;
23
+ /**
24
+ * Get a trip by id
25
+ * @param {GetTripsParams} id the trip's filters
26
+ * @returns {GetTripsResult} The GetTripsResult containing the trips and the totalCount.
27
+ */
28
+ getTrips(params: GetTripsParams): Promise<GetTripsResult>;
23
29
  }
@@ -91,3 +91,21 @@ export interface BoundariesReportEntity {
91
91
  inOutDuration?: number | null;
92
92
  totalCount: number;
93
93
  }
94
+ export interface UpsertBoundaryEventParams {
95
+ id: number;
96
+ deviceId: number;
97
+ imei: string;
98
+ boundaryId: number;
99
+ userId?: string | null;
100
+ inDate?: Date | null;
101
+ inLat?: number | null;
102
+ inLon?: number | null;
103
+ inAddress?: string | null;
104
+ outDate?: Date | null;
105
+ outLat?: number | null;
106
+ outLon?: number | null;
107
+ outAddress?: string | null;
108
+ inOutDuration?: number | null;
109
+ createdAt?: Date | null;
110
+ modifiedAt?: Date | null;
111
+ }
@@ -1,3 +1,5 @@
1
+ import { Trip } from '../entities';
2
+ import { ReportPagination } from './common';
1
3
  import { TripCompletionStatus, TripType } from './enums';
2
4
  export declare const requiredCreateTripParamsAttributes: string[];
3
5
  export interface CreateTripParams {
@@ -25,15 +27,45 @@ export interface CreateTripParams {
25
27
  }
26
28
  export declare const requiredUpdateTripEndValuesParamsAttributes: string[];
27
29
  export interface UpdateTripEndValuesParams {
28
- id: string;
29
- endDate: Date;
30
- endLat: number;
31
- endLon: number;
32
- endAddress: string;
33
- positionEnd: string;
34
- endMessageId: string;
35
- distance: number;
36
- duration: number;
37
- tripType: TripType;
38
- tripCompletionStatusId: TripCompletionStatus;
30
+ filters: {
31
+ id: string;
32
+ };
33
+ values: {
34
+ endDate: Date;
35
+ endLat: number;
36
+ endLon: number;
37
+ endAddress: string;
38
+ positionEnd: string;
39
+ endMessageId: string;
40
+ distance: number;
41
+ duration: number;
42
+ tripType: TripType;
43
+ tripCompletionStatusId: TripCompletionStatus;
44
+ };
45
+ }
46
+ export declare const requiredGetTripsParamsAttributes: string[];
47
+ export interface GetTripSortParams {
48
+ sortField?: 'startDate' | 'endDate' | 'imei' | 'tripType' | 'deviceName';
49
+ sortOrder?: 'ASC' | 'DESC';
50
+ }
51
+ export interface GetTripsParams extends ReportPagination {
52
+ filters: {
53
+ clientId: number;
54
+ from: Date;
55
+ to: Date;
56
+ tripType?: TripType;
57
+ durationMin?: number;
58
+ durationMax?: number;
59
+ distanceMin?: number;
60
+ distanceMax?: number;
61
+ imeis?: string[];
62
+ completionStatus?: TripCompletionStatus;
63
+ deviceName?: string;
64
+ deviceStatus?: 'A' | 'D';
65
+ };
66
+ sortOptions?: GetTripSortParams;
67
+ }
68
+ export interface GetTripsResult {
69
+ trips: Trip[];
70
+ totalCount: number;
39
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/nova-orm",
3
- "version": "0.0.120",
3
+ "version": "0.0.122",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",