@spytecgps/nova-orm 0.0.120 → 0.0.121

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.
@@ -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
  }
@@ -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.121",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",