@spytecgps/nova-orm 0.0.128 → 0.0.129

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 { Trip } from '../../entities';
2
- import { CreateTripParams, GetTripsParams, GetTripsResult, UpdateTripEndValuesParams } from '../../types/trip';
2
+ import { CreateTripParams, GetTripsParams, GetTripsResult, UpdateTripEndValuesParams, UpsertTripParams } from '../../types/trip';
3
3
  import { BaseRepository } from '../baseRepository';
4
4
  export declare class TripRepository extends BaseRepository {
5
5
  /**
@@ -26,4 +26,10 @@ export declare class TripRepository extends BaseRepository {
26
26
  * @returns {GetTripsResult} The GetTripsResult containing the trips and the totalCount.
27
27
  */
28
28
  getTrips(params: GetTripsParams): Promise<GetTripsResult>;
29
+ /**
30
+ * Upsert a trip
31
+ * @param {UpsertTripParams} params containing information to upsert a trip
32
+ * @returns {boolean} true if the event was upserted, false otherwise
33
+ */
34
+ upsertTrip(params: UpsertTripParams): Promise<boolean>;
29
35
  }
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { Logger } from '../../types/logger';
3
+ import { UpsertTripParams } from '../../types/trip';
4
+ export declare const upsertTrip: (novaDataSource: NovaDataSource, params: UpsertTripParams, logger: Logger) => Promise<boolean>;
@@ -24,6 +24,28 @@ export interface CreateTripParams {
24
24
  startMessageId: string;
25
25
  endMessageId?: string;
26
26
  }
27
+ export interface UpsertTripParams {
28
+ id: string;
29
+ imei?: string;
30
+ startDate?: Date;
31
+ endDate?: Date;
32
+ distance?: number;
33
+ startLat?: number;
34
+ startLon?: number;
35
+ endLat?: number;
36
+ endLon?: number;
37
+ createdAt?: Date;
38
+ startAddress?: string;
39
+ endAddress?: string;
40
+ positionStart?: string;
41
+ positionEnd?: string;
42
+ tripCompletionStatusId?: TripCompletionStatus;
43
+ clientId?: number;
44
+ duration?: number;
45
+ tripType?: TripType;
46
+ startMessageId?: string;
47
+ endMessageId?: string;
48
+ }
27
49
  export declare const requiredUpdateTripEndValuesParamsAttributes: string[];
28
50
  export interface UpdateTripEndValuesParams {
29
51
  filters: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/nova-orm",
3
- "version": "0.0.128",
3
+ "version": "0.0.129",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",