@tmlmobilidade/interfaces 20260126.1852.36 → 20260128.2248.28
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/interfaces/agencies/agencies.d.ts +2 -2
- package/dist/interfaces/alerts/alerts.d.ts +21 -18
- package/dist/interfaces/auth/roles.d.ts +126 -24
- package/dist/interfaces/auth/users.d.ts +168 -32
- package/dist/interfaces/auth/verification-tokens.d.ts +1 -1
- package/dist/interfaces/dates/annotations.d.ts +1 -1
- package/dist/interfaces/dates/index.d.ts +1 -0
- package/dist/interfaces/dates/index.js +1 -0
- package/dist/interfaces/dates/periods.d.ts +38 -0
- package/dist/interfaces/dates/periods.js +41 -0
- package/dist/interfaces/gtfs-validations/gtfs-validations.d.ts +2 -2
- package/dist/interfaces/index.d.ts +3 -0
- package/dist/interfaces/index.js +3 -0
- package/dist/interfaces/offer/index.d.ts +4 -0
- package/dist/interfaces/offer/index.js +4 -0
- package/dist/interfaces/offer/lines.d.ts +50 -0
- package/dist/interfaces/offer/lines.js +41 -0
- package/dist/interfaces/offer/patterns.d.ts +176 -0
- package/dist/interfaces/offer/patterns.js +41 -0
- package/dist/interfaces/offer/routes.d.ts +45 -0
- package/dist/interfaces/offer/routes.js +41 -0
- package/dist/interfaces/offer/typologies.d.ts +41 -0
- package/dist/interfaces/offer/typologies.js +41 -0
- package/dist/interfaces/plans/plans.d.ts +1 -1
- package/dist/interfaces/rides/pipelines.d.ts +8 -7
- package/dist/interfaces/rides/pipelines.js +56 -25
- package/dist/interfaces/rides/rides.d.ts +6 -6
- package/dist/interfaces/stops/stops.d.ts +8 -8
- package/dist/interfaces/ticketing/fares.d.ts +41 -0
- package/dist/interfaces/ticketing/fares.js +41 -0
- package/dist/interfaces/ticketing/index.d.ts +1 -0
- package/dist/interfaces/ticketing/index.js +1 -0
- package/dist/interfaces/vehicles/index.d.ts +1 -0
- package/dist/interfaces/vehicles/index.js +1 -0
- package/dist/interfaces/vehicles/vehicles.d.ts +16 -0
- package/dist/interfaces/vehicles/vehicles.js +34 -0
- package/dist/interfaces/zones/zones.d.ts +69 -3
- package/dist/providers/storage/storage.factory.js +0 -1
- package/package.json +4 -4
|
@@ -92,14 +92,15 @@ interface RidesPipelineFilter {
|
|
|
92
92
|
/**
|
|
93
93
|
* Creates MongoDB aggregation pipeline stages to filter and process ride data.
|
|
94
94
|
*
|
|
95
|
-
* This function generates an aggregation pipeline
|
|
95
|
+
* This function generates an aggregation pipeline with the following stages:
|
|
96
96
|
* 1. Filters rides by scheduled time range (date_start to date_end)
|
|
97
|
-
* 2. Optionally filters by line IDs
|
|
98
|
-
* 3. Optionally
|
|
99
|
-
* 4.
|
|
100
|
-
* 5.
|
|
101
|
-
* 6. Filters by
|
|
102
|
-
* 7.
|
|
97
|
+
* 2. Optionally filters by line IDs
|
|
98
|
+
* 3. Optionally filters by agency IDs
|
|
99
|
+
* 4. Optionally searches rides by ride ID using regex pattern matching and, if present, by vehicle IDs in the search string (with support for "v:1117,1118" etc.)
|
|
100
|
+
* 5. Adds acceptance status by joining from the ride_acceptances collection
|
|
101
|
+
* 6. Filters by analysis grades (ended_at_last_stop, expected_apex_validation_interval, simple_three_vehicle_events)
|
|
102
|
+
* 7. Filters by acceptance status (excluding 'none' if present)
|
|
103
|
+
* 8. Applies delay, operational, and seen status filters using dedicated pipeline functions
|
|
103
104
|
*
|
|
104
105
|
* @param {Object} params - Parameters object
|
|
105
106
|
* @param {RidesPipelineFilter} params.filter - Filter criteria for rides
|
|
@@ -269,14 +269,15 @@ export function ridesPipelineSeenStatus({ filter } = {}) {
|
|
|
269
269
|
/**
|
|
270
270
|
* Creates MongoDB aggregation pipeline stages to filter and process ride data.
|
|
271
271
|
*
|
|
272
|
-
* This function generates an aggregation pipeline
|
|
272
|
+
* This function generates an aggregation pipeline with the following stages:
|
|
273
273
|
* 1. Filters rides by scheduled time range (date_start to date_end)
|
|
274
|
-
* 2. Optionally filters by line IDs
|
|
275
|
-
* 3. Optionally
|
|
276
|
-
* 4.
|
|
277
|
-
* 5.
|
|
278
|
-
* 6. Filters by
|
|
279
|
-
* 7.
|
|
274
|
+
* 2. Optionally filters by line IDs
|
|
275
|
+
* 3. Optionally filters by agency IDs
|
|
276
|
+
* 4. Optionally searches rides by ride ID using regex pattern matching and, if present, by vehicle IDs in the search string (with support for "v:1117,1118" etc.)
|
|
277
|
+
* 5. Adds acceptance status by joining from the ride_acceptances collection
|
|
278
|
+
* 6. Filters by analysis grades (ended_at_last_stop, expected_apex_validation_interval, simple_three_vehicle_events)
|
|
279
|
+
* 7. Filters by acceptance status (excluding 'none' if present)
|
|
280
|
+
* 8. Applies delay, operational, and seen status filters using dedicated pipeline functions
|
|
280
281
|
*
|
|
281
282
|
* @param {Object} params - Parameters object
|
|
282
283
|
* @param {RidesPipelineFilter} params.filter - Filter criteria for rides
|
|
@@ -284,27 +285,57 @@ export function ridesPipelineSeenStatus({ filter } = {}) {
|
|
|
284
285
|
*/
|
|
285
286
|
export function ridesBatchAggregationPipeline({ ...filter }) {
|
|
286
287
|
const pipeline = [];
|
|
287
|
-
// Stage 1: Filter by scheduled time range
|
|
288
|
+
// Stage 1: Filter by scheduled time range (required)
|
|
288
289
|
pipeline.push({ $match: { start_time_scheduled: { $gte: filter.date_start, $lte: filter.date_end } } });
|
|
289
|
-
// Stage 2: Filter by
|
|
290
|
-
|
|
290
|
+
// Stage 2: Filter by agency IDs (required)
|
|
291
|
+
pipeline.push({ $match: { agency_id: { $in: filter.agency_ids ?? [] } } });
|
|
292
|
+
// Stage 3: Filter by line IDs if provided
|
|
293
|
+
if (filter.line_ids?.length)
|
|
291
294
|
pipeline.push({ $match: { line_id: { $in: filter.line_ids.map(id => Number(id)) } } });
|
|
292
|
-
// Stage 3: Filter by agency IDs if provided
|
|
293
|
-
if (filter.agency_ids)
|
|
294
|
-
pipeline.push({ $match: { agency_id: { $in: filter.agency_ids } } });
|
|
295
295
|
// Stage 4: Search by ride ID if provided
|
|
296
296
|
// Uses regex pattern matching with case-insensitive option
|
|
297
|
+
// Also removes all vehicle IDs and driver IDs from the search string
|
|
298
|
+
// And adds a filter for the vehicle IDs if they are present in the search string (v:1117,1118)
|
|
299
|
+
// And adds a filter for the driver IDs if they are present in the search string (d:123,456)
|
|
297
300
|
if (filter.search) {
|
|
298
|
-
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
// Extract vehicle and driver IDs before stripping them from search
|
|
302
|
+
const vehicleMatch = filter.search.match(/v:([\d,]+)/);
|
|
303
|
+
const driverMatch = filter.search.match(/d:([\d,]+)/);
|
|
304
|
+
// Remove v: and d: patterns from search string for ride ID matching
|
|
305
|
+
const searchWithoutSpecialFilters = filter.search.replace(/v:[\d,]+/g, '').replace(/d:[\d,]+/g, '').trim();
|
|
306
|
+
const keywords = searchWithoutSpecialFilters.split(/\s+/).filter(k => k.length > 0).map(v => v.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
|
|
307
|
+
if (keywords.length > 0) {
|
|
308
|
+
const pattern = keywords.map(k => `(?=.*${k})`).join('') + '.*';
|
|
309
|
+
pipeline.push({
|
|
310
|
+
$match: { _id: { $options: 'i', $regex: pattern } },
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
if (vehicleMatch) {
|
|
314
|
+
const vehicleIDs = vehicleMatch[1]
|
|
315
|
+
.split(',')
|
|
316
|
+
.map(id => Number(id.trim()))
|
|
317
|
+
.filter(id => !isNaN(id));
|
|
318
|
+
if (vehicleIDs.length > 0) {
|
|
319
|
+
pipeline.push({ $match: { vehicle_ids: { $in: vehicleIDs } } });
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
if (driverMatch) {
|
|
323
|
+
const driverIDs = driverMatch[1]
|
|
324
|
+
.split(',')
|
|
325
|
+
.map(id => id.trim())
|
|
326
|
+
.filter(id => id.length > 0);
|
|
327
|
+
if (driverIDs.length > 0) {
|
|
328
|
+
pipeline.push({ $match: { driver_ids: { $in: driverIDs } } });
|
|
329
|
+
}
|
|
330
|
+
}
|
|
303
331
|
}
|
|
304
|
-
// Stage 5:
|
|
332
|
+
// Stage 5: Search by vehicle IDs from search field if provided (legacy support)
|
|
333
|
+
// This allows filtering via search field with "v:1117" or "v:1117,1118" format
|
|
334
|
+
// Remove literal 'v:' from the search string since it is breaking stuff
|
|
335
|
+
// Stage 6: Add acceptance status from ride_acceptances collection
|
|
305
336
|
// Lookup joins acceptance data, unwinds to flatten, adds status field, and removes intermediate data
|
|
306
337
|
pipeline.push({ $lookup: { as: 'acceptance', foreignField: 'ride_id', from: 'ride_acceptances', localField: '_id' } }, { $unwind: { path: '$acceptance', preserveNullAndEmptyArrays: true } }, { $addFields: { acceptance_status: { $ifNull: ['$acceptance.acceptance_status', null] } } }, { $project: { acceptance: 0 } });
|
|
307
|
-
// Stage
|
|
338
|
+
// Stage 7: Filter by analysis grades
|
|
308
339
|
// Maps filter fields to their corresponding analysis paths in the document
|
|
309
340
|
const analysisFilters = [
|
|
310
341
|
{ field: 'analysis_ended_at_last_stop_grade', path: 'analysis.ENDED_AT_LAST_STOP.grade' },
|
|
@@ -330,15 +361,15 @@ export function ridesBatchAggregationPipeline({ ...filter }) {
|
|
|
330
361
|
},
|
|
331
362
|
});
|
|
332
363
|
});
|
|
333
|
-
// Stage
|
|
364
|
+
// Stage 8: Filter by acceptance status
|
|
334
365
|
// Only applies filter if acceptance_status is provided and doesn't include 'none'
|
|
335
366
|
if (filter.acceptance_status && filter.acceptance_status.length > 0 && !filter.acceptance_status.includes('none')) {
|
|
336
367
|
pipeline.push({ $match: { acceptance_status: { $exists: true } } }, { $match: { acceptance_status: { $in: filter.acceptance_status } } });
|
|
337
368
|
}
|
|
338
|
-
// Stage
|
|
369
|
+
// Stage 9: Apply status filters using dedicated pipeline functions
|
|
339
370
|
// These functions add calculated status fields and filter by them
|
|
340
|
-
pipeline.push(...ridesPipelineDelayStatus({ filter: { end_delay_status: filter.delay_statuses
|
|
341
|
-
pipeline.push(...ridesPipelineOperationalStatus({ filter: { operational_status: filter.operational_statuses
|
|
342
|
-
pipeline.push(...ridesPipelineSeenStatus({ filter: { seen_status: filter.seen_statuses
|
|
371
|
+
pipeline.push(...ridesPipelineDelayStatus({ filter: { end_delay_status: filter.delay_statuses, start_delay_status: filter.delay_statuses } }));
|
|
372
|
+
pipeline.push(...ridesPipelineOperationalStatus({ filter: { operational_status: filter.operational_statuses } }));
|
|
373
|
+
pipeline.push(...ridesPipelineSeenStatus({ filter: { seen_status: filter.seen_statuses } }));
|
|
343
374
|
return pipeline;
|
|
344
375
|
}
|
|
@@ -19,6 +19,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
|
|
|
19
19
|
created_at: number & {
|
|
20
20
|
__brand: "UnixTimestamp";
|
|
21
21
|
};
|
|
22
|
+
created_by: string | null;
|
|
22
23
|
updated_at: number & {
|
|
23
24
|
__brand: "UnixTimestamp";
|
|
24
25
|
};
|
|
@@ -154,7 +155,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
|
|
|
154
155
|
hashed_shape_id: string;
|
|
155
156
|
hashed_trip_id: string;
|
|
156
157
|
system_status: "waiting" | "processing" | "complete" | "error" | "skipped";
|
|
157
|
-
created_by?: string | undefined;
|
|
158
158
|
updated_by?: string | undefined;
|
|
159
159
|
}>[]>;
|
|
160
160
|
/**
|
|
@@ -168,6 +168,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
|
|
|
168
168
|
created_at: number & {
|
|
169
169
|
__brand: "UnixTimestamp";
|
|
170
170
|
};
|
|
171
|
+
created_by: string | null;
|
|
171
172
|
updated_at: number & {
|
|
172
173
|
__brand: "UnixTimestamp";
|
|
173
174
|
};
|
|
@@ -303,7 +304,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
|
|
|
303
304
|
hashed_shape_id: string;
|
|
304
305
|
hashed_trip_id: string;
|
|
305
306
|
system_status: "waiting" | "processing" | "complete" | "error" | "skipped";
|
|
306
|
-
created_by?: string | undefined;
|
|
307
307
|
updated_by?: string | undefined;
|
|
308
308
|
}>[]>;
|
|
309
309
|
/**
|
|
@@ -317,6 +317,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
|
|
|
317
317
|
created_at: number & {
|
|
318
318
|
__brand: "UnixTimestamp";
|
|
319
319
|
};
|
|
320
|
+
created_by: string | null;
|
|
320
321
|
updated_at: number & {
|
|
321
322
|
__brand: "UnixTimestamp";
|
|
322
323
|
};
|
|
@@ -452,7 +453,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
|
|
|
452
453
|
hashed_shape_id: string;
|
|
453
454
|
hashed_trip_id: string;
|
|
454
455
|
system_status: "waiting" | "processing" | "complete" | "error" | "skipped";
|
|
455
|
-
created_by?: string | undefined;
|
|
456
456
|
updated_by?: string | undefined;
|
|
457
457
|
}>[]>;
|
|
458
458
|
/**
|
|
@@ -466,6 +466,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
|
|
|
466
466
|
created_at: number & {
|
|
467
467
|
__brand: "UnixTimestamp";
|
|
468
468
|
};
|
|
469
|
+
created_by: string | null;
|
|
469
470
|
updated_at: number & {
|
|
470
471
|
__brand: "UnixTimestamp";
|
|
471
472
|
};
|
|
@@ -601,7 +602,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
|
|
|
601
602
|
hashed_shape_id: string;
|
|
602
603
|
hashed_trip_id: string;
|
|
603
604
|
system_status: "waiting" | "processing" | "complete" | "error" | "skipped";
|
|
604
|
-
created_by?: string | undefined;
|
|
605
605
|
updated_by?: string | undefined;
|
|
606
606
|
}>[]>;
|
|
607
607
|
/**
|
|
@@ -615,6 +615,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
|
|
|
615
615
|
created_at: number & {
|
|
616
616
|
__brand: "UnixTimestamp";
|
|
617
617
|
};
|
|
618
|
+
created_by: string | null;
|
|
618
619
|
updated_at: number & {
|
|
619
620
|
__brand: "UnixTimestamp";
|
|
620
621
|
};
|
|
@@ -750,7 +751,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
|
|
|
750
751
|
hashed_shape_id: string;
|
|
751
752
|
hashed_trip_id: string;
|
|
752
753
|
system_status: "waiting" | "processing" | "complete" | "error" | "skipped";
|
|
753
|
-
created_by?: string | undefined;
|
|
754
754
|
updated_by?: string | undefined;
|
|
755
755
|
}>[]>;
|
|
756
756
|
/**
|
|
@@ -764,6 +764,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
|
|
|
764
764
|
created_at: number & {
|
|
765
765
|
__brand: "UnixTimestamp";
|
|
766
766
|
};
|
|
767
|
+
created_by: string | null;
|
|
767
768
|
updated_at: number & {
|
|
768
769
|
__brand: "UnixTimestamp";
|
|
769
770
|
};
|
|
@@ -899,7 +900,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
|
|
|
899
900
|
hashed_shape_id: string;
|
|
900
901
|
hashed_trip_id: string;
|
|
901
902
|
system_status: "waiting" | "processing" | "complete" | "error" | "skipped";
|
|
902
|
-
created_by?: string | undefined;
|
|
903
903
|
updated_by?: string | undefined;
|
|
904
904
|
}>[]>;
|
|
905
905
|
protected getCollectionIndexes(): IndexDescription[];
|
|
@@ -35,6 +35,7 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
|
|
|
35
35
|
created_at: number & {
|
|
36
36
|
__brand: "UnixTimestamp";
|
|
37
37
|
};
|
|
38
|
+
created_by: string | null;
|
|
38
39
|
is_locked: boolean;
|
|
39
40
|
updated_at: number & {
|
|
40
41
|
__brand: "UnixTimestamp";
|
|
@@ -47,25 +48,25 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
|
|
|
47
48
|
created_at: number & {
|
|
48
49
|
__brand: "UnixTimestamp";
|
|
49
50
|
};
|
|
51
|
+
created_by: string | null;
|
|
50
52
|
updated_at: number & {
|
|
51
53
|
__brand: "UnixTimestamp";
|
|
52
54
|
};
|
|
53
55
|
message: string;
|
|
54
56
|
type: "note";
|
|
55
57
|
_id?: string | undefined;
|
|
56
|
-
created_by?: string | undefined;
|
|
57
58
|
updated_by?: string | undefined;
|
|
58
59
|
} | {
|
|
59
60
|
created_at: number & {
|
|
60
61
|
__brand: "UnixTimestamp";
|
|
61
62
|
};
|
|
63
|
+
created_by: string | null;
|
|
62
64
|
updated_at: number & {
|
|
63
65
|
__brand: "UnixTimestamp";
|
|
64
66
|
};
|
|
65
67
|
type: "field_changed";
|
|
66
68
|
field: string;
|
|
67
69
|
_id?: string | undefined;
|
|
68
|
-
created_by?: string | undefined;
|
|
69
70
|
updated_by?: string | undefined;
|
|
70
71
|
metadata?: Record<string, unknown> | null | undefined;
|
|
71
72
|
curr_value?: any;
|
|
@@ -74,13 +75,13 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
|
|
|
74
75
|
created_at: number & {
|
|
75
76
|
__brand: "UnixTimestamp";
|
|
76
77
|
};
|
|
78
|
+
created_by: string | null;
|
|
77
79
|
updated_at: number & {
|
|
78
80
|
__brand: "UnixTimestamp";
|
|
79
81
|
};
|
|
80
82
|
type: "crud";
|
|
81
83
|
action: "create" | "update" | "delete" | "archive" | "restore";
|
|
82
84
|
_id?: string | undefined;
|
|
83
|
-
created_by?: string | undefined;
|
|
84
85
|
updated_by?: string | undefined;
|
|
85
86
|
})[];
|
|
86
87
|
has_bench: "unknown" | "available" | "unavailable";
|
|
@@ -120,7 +121,6 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
|
|
|
120
121
|
file_ids: string[];
|
|
121
122
|
image_ids: string[];
|
|
122
123
|
observations: string | null;
|
|
123
|
-
created_by?: string | undefined;
|
|
124
124
|
updated_by?: string | undefined;
|
|
125
125
|
}>[]>;
|
|
126
126
|
/**
|
|
@@ -133,6 +133,7 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
|
|
|
133
133
|
created_at: number & {
|
|
134
134
|
__brand: "UnixTimestamp";
|
|
135
135
|
};
|
|
136
|
+
created_by: string | null;
|
|
136
137
|
is_locked: boolean;
|
|
137
138
|
updated_at: number & {
|
|
138
139
|
__brand: "UnixTimestamp";
|
|
@@ -145,25 +146,25 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
|
|
|
145
146
|
created_at: number & {
|
|
146
147
|
__brand: "UnixTimestamp";
|
|
147
148
|
};
|
|
149
|
+
created_by: string | null;
|
|
148
150
|
updated_at: number & {
|
|
149
151
|
__brand: "UnixTimestamp";
|
|
150
152
|
};
|
|
151
153
|
message: string;
|
|
152
154
|
type: "note";
|
|
153
155
|
_id?: string | undefined;
|
|
154
|
-
created_by?: string | undefined;
|
|
155
156
|
updated_by?: string | undefined;
|
|
156
157
|
} | {
|
|
157
158
|
created_at: number & {
|
|
158
159
|
__brand: "UnixTimestamp";
|
|
159
160
|
};
|
|
161
|
+
created_by: string | null;
|
|
160
162
|
updated_at: number & {
|
|
161
163
|
__brand: "UnixTimestamp";
|
|
162
164
|
};
|
|
163
165
|
type: "field_changed";
|
|
164
166
|
field: string;
|
|
165
167
|
_id?: string | undefined;
|
|
166
|
-
created_by?: string | undefined;
|
|
167
168
|
updated_by?: string | undefined;
|
|
168
169
|
metadata?: Record<string, unknown> | null | undefined;
|
|
169
170
|
curr_value?: any;
|
|
@@ -172,13 +173,13 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
|
|
|
172
173
|
created_at: number & {
|
|
173
174
|
__brand: "UnixTimestamp";
|
|
174
175
|
};
|
|
176
|
+
created_by: string | null;
|
|
175
177
|
updated_at: number & {
|
|
176
178
|
__brand: "UnixTimestamp";
|
|
177
179
|
};
|
|
178
180
|
type: "crud";
|
|
179
181
|
action: "create" | "update" | "delete" | "archive" | "restore";
|
|
180
182
|
_id?: string | undefined;
|
|
181
|
-
created_by?: string | undefined;
|
|
182
183
|
updated_by?: string | undefined;
|
|
183
184
|
})[];
|
|
184
185
|
has_bench: "unknown" | "available" | "unavailable";
|
|
@@ -218,7 +219,6 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
|
|
|
218
219
|
file_ids: string[];
|
|
219
220
|
image_ids: string[];
|
|
220
221
|
observations: string | null;
|
|
221
|
-
created_by?: string | undefined;
|
|
222
222
|
updated_by?: string | undefined;
|
|
223
223
|
}>[]>;
|
|
224
224
|
/**
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
2
|
+
import { type CreateFareDto, type Fare, type UpdateFareDto } from '@tmlmobilidade/types';
|
|
3
|
+
import { IndexDescription } from 'mongodb';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
declare class FaresClass extends MongoCollectionClass<Fare, CreateFareDto, UpdateFareDto> {
|
|
6
|
+
private static _instance;
|
|
7
|
+
protected createSchema: z.ZodSchema;
|
|
8
|
+
protected updateSchema: z.ZodSchema;
|
|
9
|
+
private constructor();
|
|
10
|
+
static getInstance(): Promise<FaresClass>;
|
|
11
|
+
/**
|
|
12
|
+
* Finds Fare documents by agency IDs.
|
|
13
|
+
*
|
|
14
|
+
* @param ids - The agency IDs to search for
|
|
15
|
+
// * @returns A promise that resolves to an array of matching documents
|
|
16
|
+
*/
|
|
17
|
+
findByAgencyIds(ids: string[]): Promise<import("mongodb").WithId<{
|
|
18
|
+
_id: string;
|
|
19
|
+
created_at: number & {
|
|
20
|
+
__brand: "UnixTimestamp";
|
|
21
|
+
};
|
|
22
|
+
created_by: string | null;
|
|
23
|
+
is_locked: boolean;
|
|
24
|
+
updated_at: number & {
|
|
25
|
+
__brand: "UnixTimestamp";
|
|
26
|
+
};
|
|
27
|
+
code: string;
|
|
28
|
+
name: string;
|
|
29
|
+
payment_method: "0" | "1";
|
|
30
|
+
price: number;
|
|
31
|
+
agency_ids: string[];
|
|
32
|
+
currency_type: "EUR";
|
|
33
|
+
transfers: "0" | "1" | "2" | "unlimited";
|
|
34
|
+
updated_by?: string | undefined;
|
|
35
|
+
}>[]>;
|
|
36
|
+
protected getCollectionIndexes(): IndexDescription[];
|
|
37
|
+
protected getCollectionName(): string;
|
|
38
|
+
protected getEnvName(): string;
|
|
39
|
+
}
|
|
40
|
+
export declare const fares: FaresClass;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* * */
|
|
2
|
+
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
3
|
+
import { CreateFareSchema, UpdateFareSchema } from '@tmlmobilidade/types';
|
|
4
|
+
import { AsyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
5
|
+
/* * */
|
|
6
|
+
class FaresClass extends MongoCollectionClass {
|
|
7
|
+
static _instance;
|
|
8
|
+
createSchema = CreateFareSchema;
|
|
9
|
+
updateSchema = UpdateFareSchema;
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
}
|
|
13
|
+
static async getInstance() {
|
|
14
|
+
if (!FaresClass._instance) {
|
|
15
|
+
const instance = new FaresClass();
|
|
16
|
+
await instance.connect();
|
|
17
|
+
FaresClass._instance = instance;
|
|
18
|
+
}
|
|
19
|
+
return FaresClass._instance;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Finds Fare documents by agency IDs.
|
|
23
|
+
*
|
|
24
|
+
* @param ids - The agency IDs to search for
|
|
25
|
+
// * @returns A promise that resolves to an array of matching documents
|
|
26
|
+
*/
|
|
27
|
+
async findByAgencyIds(ids) {
|
|
28
|
+
return this.mongoCollection.find({ agency_ids: { $in: ids } }).toArray();
|
|
29
|
+
}
|
|
30
|
+
getCollectionIndexes() {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
getCollectionName() {
|
|
34
|
+
return 'fares';
|
|
35
|
+
}
|
|
36
|
+
getEnvName() {
|
|
37
|
+
return 'DATABASE_URI';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/* * */
|
|
41
|
+
export const fares = AsyncSingletonProxy(FaresClass);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './fares.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './fares.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './vehicles.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './vehicles.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
2
|
+
import { type CreateVehicleDto, type UpdateVehicleDto, type Vehicle } from '@tmlmobilidade/types';
|
|
3
|
+
import { type IndexDescription } from 'mongodb';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
declare class VehiclesClass extends MongoCollectionClass<Vehicle, CreateVehicleDto, UpdateVehicleDto> {
|
|
6
|
+
private static _instance;
|
|
7
|
+
protected createSchema: z.ZodSchema;
|
|
8
|
+
protected updateSchema: z.ZodSchema;
|
|
9
|
+
private constructor();
|
|
10
|
+
static getInstance(): Promise<VehiclesClass>;
|
|
11
|
+
protected getCollectionIndexes(): IndexDescription[];
|
|
12
|
+
protected getCollectionName(): string;
|
|
13
|
+
protected getEnvName(): string;
|
|
14
|
+
}
|
|
15
|
+
export declare const vehicles: VehiclesClass;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* * */
|
|
2
|
+
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
3
|
+
import { CreateVehicleSchema, UpdateVehicleSchema } from '@tmlmobilidade/types';
|
|
4
|
+
import { AsyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
5
|
+
/* * */
|
|
6
|
+
class VehiclesClass extends MongoCollectionClass {
|
|
7
|
+
static _instance;
|
|
8
|
+
createSchema = CreateVehicleSchema;
|
|
9
|
+
updateSchema = UpdateVehicleSchema;
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
}
|
|
13
|
+
static async getInstance() {
|
|
14
|
+
if (!VehiclesClass._instance) {
|
|
15
|
+
const instance = new VehiclesClass();
|
|
16
|
+
await instance.connect();
|
|
17
|
+
VehiclesClass._instance = instance;
|
|
18
|
+
}
|
|
19
|
+
return VehiclesClass._instance;
|
|
20
|
+
}
|
|
21
|
+
getCollectionIndexes() {
|
|
22
|
+
return [
|
|
23
|
+
{ background: true, key: { name: 1 } },
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
getCollectionName() {
|
|
27
|
+
return 'vehicles';
|
|
28
|
+
}
|
|
29
|
+
getEnvName() {
|
|
30
|
+
return 'DATABASE_URI';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/* * */
|
|
34
|
+
export const vehicles = AsyncSingletonProxy(VehiclesClass);
|
|
@@ -13,20 +13,86 @@ declare class ZonesClass extends MongoCollectionClass<Zone, CreateZoneDto, Updat
|
|
|
13
13
|
* @param code The code of the zone to find
|
|
14
14
|
* @returns A promise that resolves to the matching zone document or null if not found
|
|
15
15
|
*/
|
|
16
|
-
findByCode(code: string): Promise<import("mongodb").WithId<
|
|
16
|
+
findByCode(code: string): Promise<import("mongodb").WithId<{
|
|
17
|
+
_id: string;
|
|
18
|
+
created_at: number & {
|
|
19
|
+
__brand: "UnixTimestamp";
|
|
20
|
+
};
|
|
21
|
+
created_by: string | null;
|
|
22
|
+
is_locked: boolean;
|
|
23
|
+
updated_at: number & {
|
|
24
|
+
__brand: "UnixTimestamp";
|
|
25
|
+
};
|
|
26
|
+
code: string;
|
|
27
|
+
name: string;
|
|
28
|
+
agency_ids: string[];
|
|
29
|
+
geojson: {
|
|
30
|
+
type: "Feature";
|
|
31
|
+
geometry: {
|
|
32
|
+
type: "Polygon";
|
|
33
|
+
coordinates: number[][][];
|
|
34
|
+
};
|
|
35
|
+
properties?: {} | undefined;
|
|
36
|
+
};
|
|
37
|
+
updated_by?: string | undefined;
|
|
38
|
+
}>>;
|
|
17
39
|
/**
|
|
18
40
|
* Finds a zone document by its name.
|
|
19
41
|
* @param name The name of the zone to find
|
|
20
42
|
* @returns A promise that resolves to the matching zone document or null if not found
|
|
21
43
|
*/
|
|
22
|
-
findByName(name: string): Promise<import("mongodb").WithId<
|
|
44
|
+
findByName(name: string): Promise<import("mongodb").WithId<{
|
|
45
|
+
_id: string;
|
|
46
|
+
created_at: number & {
|
|
47
|
+
__brand: "UnixTimestamp";
|
|
48
|
+
};
|
|
49
|
+
created_by: string | null;
|
|
50
|
+
is_locked: boolean;
|
|
51
|
+
updated_at: number & {
|
|
52
|
+
__brand: "UnixTimestamp";
|
|
53
|
+
};
|
|
54
|
+
code: string;
|
|
55
|
+
name: string;
|
|
56
|
+
agency_ids: string[];
|
|
57
|
+
geojson: {
|
|
58
|
+
type: "Feature";
|
|
59
|
+
geometry: {
|
|
60
|
+
type: "Polygon";
|
|
61
|
+
coordinates: number[][][];
|
|
62
|
+
};
|
|
63
|
+
properties?: {} | undefined;
|
|
64
|
+
};
|
|
65
|
+
updated_by?: string | undefined;
|
|
66
|
+
}>>;
|
|
23
67
|
/**
|
|
24
68
|
* Updates a zone document by its code.
|
|
25
69
|
* @param code The code of the zone to update.
|
|
26
70
|
* @param updateFields The fields to update in the zone document.
|
|
27
71
|
* @returns A promise that resolves to the result of the update operation.
|
|
28
72
|
*/
|
|
29
|
-
updateByCode(code: string, updateFields: Partial<Zone>): Promise<import("mongodb").UpdateResult<
|
|
73
|
+
updateByCode(code: string, updateFields: Partial<Zone>): Promise<import("mongodb").UpdateResult<{
|
|
74
|
+
_id: string;
|
|
75
|
+
created_at: number & {
|
|
76
|
+
__brand: "UnixTimestamp";
|
|
77
|
+
};
|
|
78
|
+
created_by: string | null;
|
|
79
|
+
is_locked: boolean;
|
|
80
|
+
updated_at: number & {
|
|
81
|
+
__brand: "UnixTimestamp";
|
|
82
|
+
};
|
|
83
|
+
code: string;
|
|
84
|
+
name: string;
|
|
85
|
+
agency_ids: string[];
|
|
86
|
+
geojson: {
|
|
87
|
+
type: "Feature";
|
|
88
|
+
geometry: {
|
|
89
|
+
type: "Polygon";
|
|
90
|
+
coordinates: number[][][];
|
|
91
|
+
};
|
|
92
|
+
properties?: {} | undefined;
|
|
93
|
+
};
|
|
94
|
+
updated_by?: string | undefined;
|
|
95
|
+
}>>;
|
|
30
96
|
protected getCollectionIndexes(): IndexDescription[];
|
|
31
97
|
protected getCollectionName(): string;
|
|
32
98
|
protected getEnvName(): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmlmobilidade/interfaces",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20260128.2248.28",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "iso@tmlmobilidade.pt",
|
|
6
6
|
"name": "TML-ISO"
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"@tmlmobilidade/strings": "*",
|
|
47
47
|
"@tmlmobilidade/utils": "*",
|
|
48
48
|
"bcryptjs": "3.0.3",
|
|
49
|
-
"oci-common": "2.
|
|
50
|
-
"oci-objectstorage": "2.
|
|
49
|
+
"oci-common": "2.124.0",
|
|
50
|
+
"oci-objectstorage": "2.124.0",
|
|
51
51
|
"zod": "3.25.76"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@tmlmobilidade/tsconfig": "*",
|
|
55
55
|
"@tmlmobilidade/types": "*",
|
|
56
|
-
"@types/node": "25.0
|
|
56
|
+
"@types/node": "25.1.0",
|
|
57
57
|
"resolve-tspaths": "0.8.23",
|
|
58
58
|
"tsc-watch": "7.2.0",
|
|
59
59
|
"typescript": "5.9.3"
|