@tmlmobilidade/interfaces 20250916.1106.34 → 20250916.1704.35

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,4 +1,4 @@
1
1
  export * from './hashed-shapes.js';
2
2
  export * from './hashed-trips.js';
3
- export * from './ride-justifications.js';
3
+ export * from './ride-acceptances.js';
4
4
  export * from './rides.js';
@@ -1,4 +1,4 @@
1
1
  export * from './hashed-shapes.js';
2
2
  export * from './hashed-trips.js';
3
- export * from './ride-justifications.js';
3
+ export * from './ride-acceptances.js';
4
4
  export * from './rides.js';
@@ -0,0 +1,19 @@
1
+ import { MongoCollectionClass } from '../../mongo-collection.js';
2
+ import { CreateRideAcceptanceDto, RideAcceptance, UpdateRideAcceptanceDto } from '@tmlmobilidade/types';
3
+ import { IndexDescription } from 'mongodb';
4
+ import { z } from 'zod';
5
+ declare class RideAcceptanceClass extends MongoCollectionClass<RideAcceptance, CreateRideAcceptanceDto, UpdateRideAcceptanceDto> {
6
+ private static _instance;
7
+ protected createSchema: z.ZodSchema;
8
+ protected updateSchema: z.ZodSchema;
9
+ private constructor();
10
+ static getInstance(): Promise<RideAcceptanceClass>;
11
+ createByRideId(ride_id: string, data: CreateRideAcceptanceDto): Promise<RideAcceptance>;
12
+ findByRideId(ride_id: string): Promise<null | RideAcceptance>;
13
+ updateByRideId(ride_id: string, data: UpdateRideAcceptanceDto): Promise<RideAcceptance>;
14
+ protected getCollectionIndexes(): IndexDescription[];
15
+ protected getCollectionName(): string;
16
+ protected getEnvName(): string;
17
+ }
18
+ export declare const rideAcceptances: RideAcceptanceClass;
19
+ export {};
@@ -0,0 +1,44 @@
1
+ /* * */
2
+ import { MongoCollectionClass } from '../../mongo-collection.js';
3
+ import { RideAcceptanceSchema, UpdateRideAcceptanceSchema } from '@tmlmobilidade/types';
4
+ import { AsyncSingletonProxy } from '@tmlmobilidade/utils';
5
+ /* * */
6
+ class RideAcceptanceClass extends MongoCollectionClass {
7
+ static _instance;
8
+ createSchema = RideAcceptanceSchema;
9
+ updateSchema = UpdateRideAcceptanceSchema;
10
+ constructor() {
11
+ super();
12
+ }
13
+ static async getInstance() {
14
+ if (!RideAcceptanceClass._instance) {
15
+ const instance = new RideAcceptanceClass();
16
+ await instance.connect();
17
+ RideAcceptanceClass._instance = instance;
18
+ }
19
+ return RideAcceptanceClass._instance;
20
+ }
21
+ async createByRideId(ride_id, data) {
22
+ return super.insertOne({ ...data, ride_id });
23
+ }
24
+ async findByRideId(ride_id) {
25
+ return super.findOne({ ride_id });
26
+ }
27
+ async updateByRideId(ride_id, data) {
28
+ return super.updateOne({ ride_id }, data);
29
+ }
30
+ getCollectionIndexes() {
31
+ return [
32
+ { background: true, key: { ride_id: 1 } },
33
+ { background: true, key: { acceptance_status: 1 } },
34
+ ];
35
+ }
36
+ getCollectionName() {
37
+ return 'ride_acceptances';
38
+ }
39
+ getEnvName() {
40
+ return 'DATABASE_URI';
41
+ }
42
+ }
43
+ /* * */
44
+ export const rideAcceptances = AsyncSingletonProxy(RideAcceptanceClass);
@@ -116,7 +116,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
116
116
  error_message?: string | undefined;
117
117
  };
118
118
  } | null;
119
- trip_id: string;
120
119
  apex_locations_qty: number | null;
121
120
  apex_on_board_refunds_amount: number | null;
122
121
  apex_on_board_refunds_qty: number | null;
@@ -153,6 +152,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
153
152
  __brand: "UnixTimestamp";
154
153
  };
155
154
  system_status: "waiting" | "processing" | "complete" | "error";
155
+ trip_id: string;
156
156
  vehicle_ids: number[];
157
157
  created_by?: string | undefined;
158
158
  updated_by?: string | undefined;
@@ -265,7 +265,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
265
265
  error_message?: string | undefined;
266
266
  };
267
267
  } | null;
268
- trip_id: string;
269
268
  apex_locations_qty: number | null;
270
269
  apex_on_board_refunds_amount: number | null;
271
270
  apex_on_board_refunds_qty: number | null;
@@ -302,6 +301,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
302
301
  __brand: "UnixTimestamp";
303
302
  };
304
303
  system_status: "waiting" | "processing" | "complete" | "error";
304
+ trip_id: string;
305
305
  vehicle_ids: number[];
306
306
  created_by?: string | undefined;
307
307
  updated_by?: string | undefined;
@@ -414,7 +414,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
414
414
  error_message?: string | undefined;
415
415
  };
416
416
  } | null;
417
- trip_id: string;
418
417
  apex_locations_qty: number | null;
419
418
  apex_on_board_refunds_amount: number | null;
420
419
  apex_on_board_refunds_qty: number | null;
@@ -451,6 +450,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
451
450
  __brand: "UnixTimestamp";
452
451
  };
453
452
  system_status: "waiting" | "processing" | "complete" | "error";
453
+ trip_id: string;
454
454
  vehicle_ids: number[];
455
455
  created_by?: string | undefined;
456
456
  updated_by?: string | undefined;
@@ -563,7 +563,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
563
563
  error_message?: string | undefined;
564
564
  };
565
565
  } | null;
566
- trip_id: string;
567
566
  apex_locations_qty: number | null;
568
567
  apex_on_board_refunds_amount: number | null;
569
568
  apex_on_board_refunds_qty: number | null;
@@ -600,6 +599,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
600
599
  __brand: "UnixTimestamp";
601
600
  };
602
601
  system_status: "waiting" | "processing" | "complete" | "error";
602
+ trip_id: string;
603
603
  vehicle_ids: number[];
604
604
  created_by?: string | undefined;
605
605
  updated_by?: string | undefined;
@@ -712,7 +712,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
712
712
  error_message?: string | undefined;
713
713
  };
714
714
  } | null;
715
- trip_id: string;
716
715
  apex_locations_qty: number | null;
717
716
  apex_on_board_refunds_amount: number | null;
718
717
  apex_on_board_refunds_qty: number | null;
@@ -749,6 +748,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
749
748
  __brand: "UnixTimestamp";
750
749
  };
751
750
  system_status: "waiting" | "processing" | "complete" | "error";
751
+ trip_id: string;
752
752
  vehicle_ids: number[];
753
753
  created_by?: string | undefined;
754
754
  updated_by?: string | undefined;
@@ -861,7 +861,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
861
861
  error_message?: string | undefined;
862
862
  };
863
863
  } | null;
864
- trip_id: string;
865
864
  apex_locations_qty: number | null;
866
865
  apex_on_board_refunds_amount: number | null;
867
866
  apex_on_board_refunds_qty: number | null;
@@ -898,6 +897,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
898
897
  __brand: "UnixTimestamp";
899
898
  };
900
899
  system_status: "waiting" | "processing" | "complete" | "error";
900
+ trip_id: string;
901
901
  vehicle_ids: number[];
902
902
  created_by?: string | undefined;
903
903
  updated_by?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/interfaces",
3
- "version": "20250916.1106.34",
3
+ "version": "20250916.1704.35",
4
4
  "author": "João de Vasconcelos & Jusi Monteiro",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "homepage": "https://github.com/tmlmobilidade/services#readme",
@@ -1,19 +0,0 @@
1
- import { MongoCollectionClass } from '../../mongo-collection.js';
2
- import { CreateRideJustificationDto, RideJustification, UpdateRideJustificationDto } from '@tmlmobilidade/types';
3
- import { IndexDescription } from 'mongodb';
4
- import { z } from 'zod';
5
- declare class RideJustificationClass extends MongoCollectionClass<RideJustification, CreateRideJustificationDto, UpdateRideJustificationDto> {
6
- private static _instance;
7
- protected createSchema: z.ZodSchema;
8
- protected updateSchema: z.ZodSchema;
9
- private constructor();
10
- static getInstance(): Promise<RideJustificationClass>;
11
- createByTripId(trip_id: string, data: CreateRideJustificationDto): Promise<RideJustification>;
12
- findByTripId(trip_id: string): Promise<null | RideJustification>;
13
- updateByTripId(trip_id: string, data: UpdateRideJustificationDto): Promise<RideJustification>;
14
- protected getCollectionIndexes(): IndexDescription[];
15
- protected getCollectionName(): string;
16
- protected getEnvName(): string;
17
- }
18
- export declare const rideJustifications: RideJustificationClass;
19
- export {};
@@ -1,44 +0,0 @@
1
- /* * */
2
- import { MongoCollectionClass } from '../../mongo-collection.js';
3
- import { RideJustificationSchema, UpdateRideJustificationSchema } from '@tmlmobilidade/types';
4
- import { AsyncSingletonProxy } from '@tmlmobilidade/utils';
5
- /* * */
6
- class RideJustificationClass extends MongoCollectionClass {
7
- static _instance;
8
- createSchema = RideJustificationSchema;
9
- updateSchema = UpdateRideJustificationSchema;
10
- constructor() {
11
- super();
12
- }
13
- static async getInstance() {
14
- if (!RideJustificationClass._instance) {
15
- const instance = new RideJustificationClass();
16
- await instance.connect();
17
- RideJustificationClass._instance = instance;
18
- }
19
- return RideJustificationClass._instance;
20
- }
21
- async createByTripId(trip_id, data) {
22
- return super.insertOne({ ...data, trip_id });
23
- }
24
- async findByTripId(trip_id) {
25
- return super.findOne({ trip_id });
26
- }
27
- async updateByTripId(trip_id, data) {
28
- return super.updateOne({ trip_id }, data);
29
- }
30
- getCollectionIndexes() {
31
- return [
32
- { background: true, key: { trip_id: 1 } },
33
- { background: true, key: { acceptance_status: 1 } },
34
- ];
35
- }
36
- getCollectionName() {
37
- return 'ride_justifications';
38
- }
39
- getEnvName() {
40
- return 'DATABASE_URI';
41
- }
42
- }
43
- /* * */
44
- export const rideJustifications = AsyncSingletonProxy(RideJustificationClass);