@tmlmobilidade/interfaces 20260720.2249.10 → 20260723.1350.16
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/common/index.d.ts +0 -1
- package/dist/common/index.js +0 -1
- package/dist/interfaces/index.d.ts +0 -8
- package/dist/interfaces/index.js +0 -8
- package/dist/interfaces/rides/index.d.ts +0 -5
- package/dist/interfaces/rides/index.js +0 -5
- package/dist/interfaces/rides/pipelines.d.ts +1 -1
- package/dist/interfaces/rides/pipelines.js +3 -3
- package/dist/interfaces/simplified-apex/index.d.ts +0 -2
- package/dist/interfaces/simplified-apex/index.js +0 -2
- package/dist/interfaces/vehicle-events/simplified-vehicle-events.d.ts +1 -1
- package/package.json +3 -2
- package/dist/common/mongo-transaction.d.ts +0 -25
- package/dist/common/mongo-transaction.js +0 -61
- package/dist/interfaces/alerts/alerts.d.ts +0 -124
- package/dist/interfaces/alerts/alerts.js +0 -50
- package/dist/interfaces/alerts/index.d.ts +0 -1
- package/dist/interfaces/alerts/index.js +0 -1
- package/dist/interfaces/file-exports/file-exports.d.ts +0 -20
- package/dist/interfaces/file-exports/file-exports.js +0 -47
- package/dist/interfaces/file-exports/index.d.ts +0 -1
- package/dist/interfaces/file-exports/index.js +0 -1
- package/dist/interfaces/files/files.d.ts +0 -63
- package/dist/interfaces/files/files.js +0 -198
- package/dist/interfaces/files/index.d.ts +0 -1
- package/dist/interfaces/files/index.js +0 -1
- package/dist/interfaces/gtfs-validations/gtfs-validations.d.ts +0 -71
- package/dist/interfaces/gtfs-validations/gtfs-validations.js +0 -40
- package/dist/interfaces/gtfs-validations/index.d.ts +0 -1
- package/dist/interfaces/gtfs-validations/index.js +0 -1
- package/dist/interfaces/pcgidb/index.d.ts +0 -3
- package/dist/interfaces/pcgidb/index.js +0 -3
- package/dist/interfaces/pcgidb/pcgidb-legacy.d.ts +0 -21
- package/dist/interfaces/pcgidb/pcgidb-legacy.js +0 -82
- package/dist/interfaces/pcgidb/pcgidb-ticketing.d.ts +0 -20
- package/dist/interfaces/pcgidb/pcgidb-ticketing.js +0 -81
- package/dist/interfaces/pcgidb/pcgidb-validations.d.ts +0 -21
- package/dist/interfaces/pcgidb/pcgidb-validations.js +0 -84
- package/dist/interfaces/plans/index.d.ts +0 -1
- package/dist/interfaces/plans/index.js +0 -1
- package/dist/interfaces/plans/plans.d.ts +0 -83
- package/dist/interfaces/plans/plans.js +0 -41
- package/dist/interfaces/rides/hashed-patterns.d.ts +0 -16
- package/dist/interfaces/rides/hashed-patterns.js +0 -35
- package/dist/interfaces/rides/hashed-shapes.d.ts +0 -16
- package/dist/interfaces/rides/hashed-shapes.js +0 -34
- package/dist/interfaces/rides/hashed-trips.d.ts +0 -16
- package/dist/interfaces/rides/hashed-trips.js +0 -35
- package/dist/interfaces/rides/ride-acceptances.d.ts +0 -23
- package/dist/interfaces/rides/ride-acceptances.js +0 -85
- package/dist/interfaces/rides/rides.d.ts +0 -922
- package/dist/interfaces/rides/rides.js +0 -107
- package/dist/interfaces/simplified-apex/simplified-apex-inspection-decisions.d.ts +0 -13
- package/dist/interfaces/simplified-apex/simplified-apex-inspection-decisions.js +0 -36
- package/dist/interfaces/simplified-apex/simplified-apex-inspections.d.ts +0 -13
- package/dist/interfaces/simplified-apex/simplified-apex-inspections.js +0 -36
- package/dist/interfaces/stops/index.d.ts +0 -1
- package/dist/interfaces/stops/index.js +0 -1
- package/dist/interfaces/stops/stops.d.ts +0 -289
- package/dist/interfaces/stops/stops.js +0 -105
- package/dist/interfaces/vehicles/index.d.ts +0 -1
- package/dist/interfaces/vehicles/index.js +0 -1
- package/dist/interfaces/vehicles/vehicles.d.ts +0 -16
- package/dist/interfaces/vehicles/vehicles.js +0 -34
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/* * */
|
|
2
|
-
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
3
|
-
import { CreateRideSchema, UpdateRideSchema } from '@tmlmobilidade/types';
|
|
4
|
-
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
5
|
-
/* * */
|
|
6
|
-
class RidesClass extends MongoCollectionClass {
|
|
7
|
-
static _instance;
|
|
8
|
-
createSchema = CreateRideSchema;
|
|
9
|
-
updateSchema = UpdateRideSchema;
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
}
|
|
13
|
-
static async getInstance() {
|
|
14
|
-
if (!RidesClass._instance) {
|
|
15
|
-
const instance = new RidesClass();
|
|
16
|
-
await instance.connect();
|
|
17
|
-
RidesClass._instance = instance;
|
|
18
|
-
}
|
|
19
|
-
return RidesClass._instance;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Finds ride documents by Agency ID.
|
|
23
|
-
*
|
|
24
|
-
* @param agencyId - The Agency ID to search for
|
|
25
|
-
* @returns A promise that resolves to an array of matching ride documents
|
|
26
|
-
*/
|
|
27
|
-
async findByAgencyId(agencyId) {
|
|
28
|
-
return this.mongoCollection.find({ agency_id: agencyId }).toArray();
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Finds ride documents by Line ID.
|
|
32
|
-
*
|
|
33
|
-
* @param lineId - The Line ID to search for
|
|
34
|
-
* @returns A promise that resolves to an array of matching ride documents
|
|
35
|
-
*/
|
|
36
|
-
async findByLineId(lineId) {
|
|
37
|
-
return this.mongoCollection.find({ line_id: lineId }).toArray();
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Finds ride documents by Pattern ID.
|
|
41
|
-
*
|
|
42
|
-
* @param patternId - The Pattern ID to search for
|
|
43
|
-
* @returns A promise that resolves to an array of matching ride documents
|
|
44
|
-
*/
|
|
45
|
-
async findByPatternId(patternId) {
|
|
46
|
-
return this.mongoCollection.find({ pattern_id: patternId }).toArray();
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Finds ride documents by Plan ID.
|
|
50
|
-
*
|
|
51
|
-
* @param planId - The Plan ID to search for
|
|
52
|
-
* @returns A promise that resolves to an array of matching ride documents
|
|
53
|
-
*/
|
|
54
|
-
async findByPlanId(planId) {
|
|
55
|
-
return this.mongoCollection.find({ plan_id: planId }).toArray();
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Finds ride documents by Route ID.
|
|
59
|
-
*
|
|
60
|
-
* @param routeId - The Route ID to search for
|
|
61
|
-
* @returns A promise that resolves to an array of matching ride documents
|
|
62
|
-
*/
|
|
63
|
-
async findByRouteId(routeId) {
|
|
64
|
-
return this.mongoCollection.find({ route_id: routeId }).toArray();
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Finds ride documents by Trip ID.
|
|
68
|
-
*
|
|
69
|
-
* @param tripId - The Trip ID to search for
|
|
70
|
-
* @returns A promise that resolves to an array of matching ride documents
|
|
71
|
-
*/
|
|
72
|
-
async findByTripId(tripId) {
|
|
73
|
-
return this.mongoCollection.find({ trip_id: tripId }).toArray();
|
|
74
|
-
}
|
|
75
|
-
getCollectionIndexes() {
|
|
76
|
-
/**
|
|
77
|
-
* IMPORTANT:
|
|
78
|
-
* Automatic sorting (ESLint) of keys in the JS objects should be disabled.
|
|
79
|
-
* The order of keys in a compound index is very important and should be
|
|
80
|
-
* carefully considered based on the cardinality of each key.
|
|
81
|
-
*/
|
|
82
|
-
return [
|
|
83
|
-
{ background: true, key: { hashed_trip_id: 1 } },
|
|
84
|
-
{ background: true, key: { hashed_shape_id: 1 } },
|
|
85
|
-
{ background: true, key: { operational_date: 1 } },
|
|
86
|
-
{ background: true, key: { operational_date: 1, system_status: 1 } },
|
|
87
|
-
{ background: true, key: { start_time_scheduled: 1 } },
|
|
88
|
-
{ background: true, key: { system_status: 1 } },
|
|
89
|
-
{ background: true, key: { agency_id: 1, start_time_scheduled: -1, hashed_trip_id: 1 } },
|
|
90
|
-
{ background: true, key: { hashed_trip_id: 1, start_time_scheduled: -1 } },
|
|
91
|
-
// eslint-disable-next-line perfectionist/sort-objects
|
|
92
|
-
{ background: true, key: { system_status: 1, start_time_scheduled: 1 } },
|
|
93
|
-
// eslint-disable-next-line perfectionist/sort-objects
|
|
94
|
-
{ background: true, key: { trip_id: 1, start_time_scheduled: 1 } },
|
|
95
|
-
{ background: true, key: { trip_id: 1 } },
|
|
96
|
-
{ background: true, key: { plan_id: 1 } },
|
|
97
|
-
];
|
|
98
|
-
}
|
|
99
|
-
getCollectionName() {
|
|
100
|
-
return 'rides';
|
|
101
|
-
}
|
|
102
|
-
getEnvName() {
|
|
103
|
-
return 'DATABASE_URI';
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
/* * */
|
|
107
|
-
export const rides = asyncSingletonProxy(RidesClass);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
2
|
-
import { type SimplifiedApexInspectionDecision } from '@tmlmobilidade/go-types-apex';
|
|
3
|
-
import { IndexDescription } from 'mongodb';
|
|
4
|
-
declare class SimplifiedApexInspectionDecisionsClass extends MongoCollectionClass<SimplifiedApexInspectionDecision, SimplifiedApexInspectionDecision, SimplifiedApexInspectionDecision> {
|
|
5
|
-
private static _instance;
|
|
6
|
-
private constructor();
|
|
7
|
-
static getInstance(): Promise<SimplifiedApexInspectionDecisionsClass>;
|
|
8
|
-
protected getCollectionIndexes(): IndexDescription[];
|
|
9
|
-
protected getCollectionName(): string;
|
|
10
|
-
protected getEnvName(): string;
|
|
11
|
-
}
|
|
12
|
-
export declare const simplifiedApexInspectionDecisions: SimplifiedApexInspectionDecisionsClass;
|
|
13
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/* * */
|
|
2
|
-
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
3
|
-
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
4
|
-
/* * */
|
|
5
|
-
class SimplifiedApexInspectionDecisionsClass extends MongoCollectionClass {
|
|
6
|
-
static _instance;
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
}
|
|
10
|
-
static async getInstance() {
|
|
11
|
-
if (!SimplifiedApexInspectionDecisionsClass._instance) {
|
|
12
|
-
const instance = new SimplifiedApexInspectionDecisionsClass();
|
|
13
|
-
await instance.connect();
|
|
14
|
-
SimplifiedApexInspectionDecisionsClass._instance = instance;
|
|
15
|
-
}
|
|
16
|
-
return SimplifiedApexInspectionDecisionsClass._instance;
|
|
17
|
-
}
|
|
18
|
-
getCollectionIndexes() {
|
|
19
|
-
return [
|
|
20
|
-
{ background: true, key: { created_at: 1 } },
|
|
21
|
-
{ background: true, key: { received_at: 1 } },
|
|
22
|
-
{ background: true, key: { agency_id: 1 } },
|
|
23
|
-
// eslint-disable-next-line perfectionist/sort-objects
|
|
24
|
-
{ background: true, key: { trip_id: 1, created_at: 1 } },
|
|
25
|
-
{ background: true, key: { agency_id: 1, created_at: 1 } },
|
|
26
|
-
];
|
|
27
|
-
}
|
|
28
|
-
getCollectionName() {
|
|
29
|
-
return 'simplified_apex_inspection_decisions';
|
|
30
|
-
}
|
|
31
|
-
getEnvName() {
|
|
32
|
-
return 'TML_INTERFACE_SIMPLIFIED_APEX_INSPECTION_DECISIONS';
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/* * */
|
|
36
|
-
export const simplifiedApexInspectionDecisions = asyncSingletonProxy(SimplifiedApexInspectionDecisionsClass);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
2
|
-
import { type SimplifiedApexInspection } from '@tmlmobilidade/go-types-apex';
|
|
3
|
-
import { IndexDescription } from 'mongodb';
|
|
4
|
-
declare class SimplifiedApexInspectionsClass extends MongoCollectionClass<SimplifiedApexInspection, SimplifiedApexInspection, SimplifiedApexInspection> {
|
|
5
|
-
private static _instance;
|
|
6
|
-
private constructor();
|
|
7
|
-
static getInstance(): Promise<SimplifiedApexInspectionsClass>;
|
|
8
|
-
protected getCollectionIndexes(): IndexDescription[];
|
|
9
|
-
protected getCollectionName(): string;
|
|
10
|
-
protected getEnvName(): string;
|
|
11
|
-
}
|
|
12
|
-
export declare const simplifiedApexInspections: SimplifiedApexInspectionsClass;
|
|
13
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/* * */
|
|
2
|
-
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
3
|
-
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
4
|
-
/* * */
|
|
5
|
-
class SimplifiedApexInspectionsClass extends MongoCollectionClass {
|
|
6
|
-
static _instance;
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
}
|
|
10
|
-
static async getInstance() {
|
|
11
|
-
if (!SimplifiedApexInspectionsClass._instance) {
|
|
12
|
-
const instance = new SimplifiedApexInspectionsClass();
|
|
13
|
-
await instance.connect();
|
|
14
|
-
SimplifiedApexInspectionsClass._instance = instance;
|
|
15
|
-
}
|
|
16
|
-
return SimplifiedApexInspectionsClass._instance;
|
|
17
|
-
}
|
|
18
|
-
getCollectionIndexes() {
|
|
19
|
-
return [
|
|
20
|
-
{ background: true, key: { created_at: 1 } },
|
|
21
|
-
{ background: true, key: { received_at: 1 } },
|
|
22
|
-
{ background: true, key: { agency_id: 1 } },
|
|
23
|
-
// eslint-disable-next-line perfectionist/sort-objects
|
|
24
|
-
{ background: true, key: { trip_id: 1, created_at: 1 } },
|
|
25
|
-
{ background: true, key: { agency_id: 1, created_at: 1 } },
|
|
26
|
-
];
|
|
27
|
-
}
|
|
28
|
-
getCollectionName() {
|
|
29
|
-
return 'simplified_apex_inspections';
|
|
30
|
-
}
|
|
31
|
-
getEnvName() {
|
|
32
|
-
return 'TML_INTERFACE_SIMPLIFIED_APEX_INSPECTIONS';
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/* * */
|
|
36
|
-
export const simplifiedApexInspections = asyncSingletonProxy(SimplifiedApexInspectionsClass);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './stops.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './stops.js';
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
2
|
-
import { type CreateStopDto, type Stop, type UpdateStopDto } from '@tmlmobilidade/types';
|
|
3
|
-
import { type DeleteResult, type IndexDescription, type Sort } from 'mongodb';
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, UpdateStopDto> {
|
|
6
|
-
private static _instance;
|
|
7
|
-
protected createSchema: z.ZodSchema;
|
|
8
|
-
protected updateSchema: z.ZodSchema;
|
|
9
|
-
private constructor();
|
|
10
|
-
static getInstance(): Promise<StopsClass>;
|
|
11
|
-
/**
|
|
12
|
-
* Override deleteById to prevent actual deletion of stop documents.
|
|
13
|
-
* Stops cannot be deleted, only archived.
|
|
14
|
-
* @param filter The filter used to select the document to "delete".
|
|
15
|
-
* @returns A promise that rejects with an error indicating deletion is not allowed.
|
|
16
|
-
*/
|
|
17
|
-
deleteById(): Promise<DeleteResult>;
|
|
18
|
-
/**
|
|
19
|
-
* Override deleteOne to prevent actual deletion of stop documents.
|
|
20
|
-
* Stops cannot be deleted, only archived.
|
|
21
|
-
* @param filter The filter used to select the document to "delete".
|
|
22
|
-
* @returns A promise that rejects with an error indicating deletion is not allowed.
|
|
23
|
-
*/
|
|
24
|
-
deleteOne(): Promise<DeleteResult>;
|
|
25
|
-
/**
|
|
26
|
-
* Override deleteMany to prevent actual deletion of stop documents.
|
|
27
|
-
* Stops cannot be deleted, only archived.
|
|
28
|
-
* @param filter The filter used to select the documents to "delete".
|
|
29
|
-
* @returns A promise that rejects with an error indicating deletion is not allowed.
|
|
30
|
-
*/
|
|
31
|
-
deleteMany(): Promise<DeleteResult>;
|
|
32
|
-
/**
|
|
33
|
-
* Finds stop documents by municipality ID with optional pagination and sorting.
|
|
34
|
-
* @param id The municipality ID to search for
|
|
35
|
-
* @param perPage Optional number of documents per page for pagination
|
|
36
|
-
* @param page Optional page number for pagination
|
|
37
|
-
* @param sort Optional sort specification
|
|
38
|
-
* @returns A promise that resolves to an array of matching stop documents
|
|
39
|
-
*/
|
|
40
|
-
findByMunicipalityId(id: string, perPage?: number, page?: number, sort?: Sort): Promise<import("mongodb").WithId<{
|
|
41
|
-
_id: number;
|
|
42
|
-
created_at: number & {
|
|
43
|
-
__brand: "UnixTimestamp";
|
|
44
|
-
};
|
|
45
|
-
created_by: string | null;
|
|
46
|
-
is_locked: boolean;
|
|
47
|
-
updated_at: number & {
|
|
48
|
-
__brand: "UnixTimestamp";
|
|
49
|
-
};
|
|
50
|
-
name: string;
|
|
51
|
-
short_name: string;
|
|
52
|
-
associated_patterns: {
|
|
53
|
-
_id: string;
|
|
54
|
-
code: string;
|
|
55
|
-
headsign: string;
|
|
56
|
-
line_id: string;
|
|
57
|
-
route_id: string;
|
|
58
|
-
}[];
|
|
59
|
-
comments: ({
|
|
60
|
-
message: string;
|
|
61
|
-
type: "note";
|
|
62
|
-
created_at: number & {
|
|
63
|
-
__brand: "UnixTimestamp";
|
|
64
|
-
};
|
|
65
|
-
created_by: string | null;
|
|
66
|
-
updated_at: number & {
|
|
67
|
-
__brand: "UnixTimestamp";
|
|
68
|
-
};
|
|
69
|
-
_id?: string | undefined;
|
|
70
|
-
updated_by?: string | undefined;
|
|
71
|
-
} | {
|
|
72
|
-
type: "field_changed";
|
|
73
|
-
created_at: number & {
|
|
74
|
-
__brand: "UnixTimestamp";
|
|
75
|
-
};
|
|
76
|
-
created_by: string | null;
|
|
77
|
-
updated_at: number & {
|
|
78
|
-
__brand: "UnixTimestamp";
|
|
79
|
-
};
|
|
80
|
-
field: string;
|
|
81
|
-
_id?: string | undefined;
|
|
82
|
-
updated_by?: string | undefined;
|
|
83
|
-
curr_value?: any;
|
|
84
|
-
prev_value?: any;
|
|
85
|
-
metadata?: {
|
|
86
|
-
changes?: {
|
|
87
|
-
field: string;
|
|
88
|
-
curr_value?: any;
|
|
89
|
-
prev_value?: any;
|
|
90
|
-
}[] | undefined;
|
|
91
|
-
} | null | undefined;
|
|
92
|
-
} | {
|
|
93
|
-
type: "crud";
|
|
94
|
-
created_at: number & {
|
|
95
|
-
__brand: "UnixTimestamp";
|
|
96
|
-
};
|
|
97
|
-
created_by: string | null;
|
|
98
|
-
updated_at: number & {
|
|
99
|
-
__brand: "UnixTimestamp";
|
|
100
|
-
};
|
|
101
|
-
action: "create" | "update" | "delete" | "archive" | "restore";
|
|
102
|
-
_id?: string | undefined;
|
|
103
|
-
updated_by?: string | undefined;
|
|
104
|
-
})[];
|
|
105
|
-
flags: {
|
|
106
|
-
short_name: string;
|
|
107
|
-
agency_ids: string[];
|
|
108
|
-
is_harmonized: boolean;
|
|
109
|
-
stop_id: string;
|
|
110
|
-
}[];
|
|
111
|
-
jurisdiction: "unknown" | "ip" | "municipality" | "other";
|
|
112
|
-
legacy_id: string | null;
|
|
113
|
-
legacy_ids: string[];
|
|
114
|
-
lifecycle_status: "draft" | "active" | "inactive" | "provisional" | "seasonal" | "voided";
|
|
115
|
-
new_name: string | null;
|
|
116
|
-
previous_go_id: string | null;
|
|
117
|
-
tts_name: string;
|
|
118
|
-
district_id: string;
|
|
119
|
-
latitude: number;
|
|
120
|
-
locality_id: string | null;
|
|
121
|
-
longitude: number;
|
|
122
|
-
municipality_id: string;
|
|
123
|
-
parish_id: string | null;
|
|
124
|
-
bench_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
|
|
125
|
-
electricity_status: "unknown" | "available" | "unavailable";
|
|
126
|
-
pole_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
|
|
127
|
-
road_type: "unknown" | "complementary_itinerary" | "highway" | "main_itinerary" | "national_road" | "regional_road" | "secondary_road";
|
|
128
|
-
shelter_code: string | null;
|
|
129
|
-
shelter_frame_size: [number, number] | null;
|
|
130
|
-
shelter_installation_date: import("@tmlmobilidade/types").UnixTimestamp | null;
|
|
131
|
-
shelter_maintainer: string | null;
|
|
132
|
-
shelter_make: string | null;
|
|
133
|
-
shelter_model: string | null;
|
|
134
|
-
shelter_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
|
|
135
|
-
last_infrastructure_check: import("@tmlmobilidade/types").UnixTimestamp | null;
|
|
136
|
-
last_infrastructure_maintenance: import("@tmlmobilidade/types").UnixTimestamp | null;
|
|
137
|
-
last_schedules_check: import("@tmlmobilidade/types").UnixTimestamp | null;
|
|
138
|
-
last_schedules_maintenance: import("@tmlmobilidade/types").UnixTimestamp | null;
|
|
139
|
-
connections: ("ferry" | "light_rail" | "subway" | "train" | "boat" | "airport" | "bike_sharing" | "bike_parking" | "car_parking")[];
|
|
140
|
-
facilities: ("fire_station" | "health_clinic" | "historic_building" | "hospital" | "police_station" | "school" | "shopping" | "transit_office" | "university" | "beach")[];
|
|
141
|
-
equipment: ("pip" | "mupi" | "mini_pip")[];
|
|
142
|
-
has_bench: "unknown" | "available" | "unavailable";
|
|
143
|
-
has_mupi: "unknown" | "available" | "unavailable";
|
|
144
|
-
has_network_map: "unknown" | "available" | "unavailable";
|
|
145
|
-
has_schedules: "unknown" | "available" | "unavailable";
|
|
146
|
-
has_shelter: "unknown" | "available" | "unavailable";
|
|
147
|
-
has_stop_sign: "unknown" | "available" | "unavailable";
|
|
148
|
-
observations: string | null;
|
|
149
|
-
is_deleted: boolean;
|
|
150
|
-
tts_hash: string;
|
|
151
|
-
file_ids: string[];
|
|
152
|
-
image_ids: string[];
|
|
153
|
-
updated_by?: string | undefined;
|
|
154
|
-
}>[]>;
|
|
155
|
-
/**
|
|
156
|
-
* Finds multiple stop documents by their IDs.
|
|
157
|
-
* @param ids Array of stop IDs to search for
|
|
158
|
-
* @returns A promise that resolves to an array of matching stop documents
|
|
159
|
-
*/
|
|
160
|
-
findManyByIds(ids: number[]): Promise<import("mongodb").WithId<{
|
|
161
|
-
_id: number;
|
|
162
|
-
created_at: number & {
|
|
163
|
-
__brand: "UnixTimestamp";
|
|
164
|
-
};
|
|
165
|
-
created_by: string | null;
|
|
166
|
-
is_locked: boolean;
|
|
167
|
-
updated_at: number & {
|
|
168
|
-
__brand: "UnixTimestamp";
|
|
169
|
-
};
|
|
170
|
-
name: string;
|
|
171
|
-
short_name: string;
|
|
172
|
-
associated_patterns: {
|
|
173
|
-
_id: string;
|
|
174
|
-
code: string;
|
|
175
|
-
headsign: string;
|
|
176
|
-
line_id: string;
|
|
177
|
-
route_id: string;
|
|
178
|
-
}[];
|
|
179
|
-
comments: ({
|
|
180
|
-
message: string;
|
|
181
|
-
type: "note";
|
|
182
|
-
created_at: number & {
|
|
183
|
-
__brand: "UnixTimestamp";
|
|
184
|
-
};
|
|
185
|
-
created_by: string | null;
|
|
186
|
-
updated_at: number & {
|
|
187
|
-
__brand: "UnixTimestamp";
|
|
188
|
-
};
|
|
189
|
-
_id?: string | undefined;
|
|
190
|
-
updated_by?: string | undefined;
|
|
191
|
-
} | {
|
|
192
|
-
type: "field_changed";
|
|
193
|
-
created_at: number & {
|
|
194
|
-
__brand: "UnixTimestamp";
|
|
195
|
-
};
|
|
196
|
-
created_by: string | null;
|
|
197
|
-
updated_at: number & {
|
|
198
|
-
__brand: "UnixTimestamp";
|
|
199
|
-
};
|
|
200
|
-
field: string;
|
|
201
|
-
_id?: string | undefined;
|
|
202
|
-
updated_by?: string | undefined;
|
|
203
|
-
curr_value?: any;
|
|
204
|
-
prev_value?: any;
|
|
205
|
-
metadata?: {
|
|
206
|
-
changes?: {
|
|
207
|
-
field: string;
|
|
208
|
-
curr_value?: any;
|
|
209
|
-
prev_value?: any;
|
|
210
|
-
}[] | undefined;
|
|
211
|
-
} | null | undefined;
|
|
212
|
-
} | {
|
|
213
|
-
type: "crud";
|
|
214
|
-
created_at: number & {
|
|
215
|
-
__brand: "UnixTimestamp";
|
|
216
|
-
};
|
|
217
|
-
created_by: string | null;
|
|
218
|
-
updated_at: number & {
|
|
219
|
-
__brand: "UnixTimestamp";
|
|
220
|
-
};
|
|
221
|
-
action: "create" | "update" | "delete" | "archive" | "restore";
|
|
222
|
-
_id?: string | undefined;
|
|
223
|
-
updated_by?: string | undefined;
|
|
224
|
-
})[];
|
|
225
|
-
flags: {
|
|
226
|
-
short_name: string;
|
|
227
|
-
agency_ids: string[];
|
|
228
|
-
is_harmonized: boolean;
|
|
229
|
-
stop_id: string;
|
|
230
|
-
}[];
|
|
231
|
-
jurisdiction: "unknown" | "ip" | "municipality" | "other";
|
|
232
|
-
legacy_id: string | null;
|
|
233
|
-
legacy_ids: string[];
|
|
234
|
-
lifecycle_status: "draft" | "active" | "inactive" | "provisional" | "seasonal" | "voided";
|
|
235
|
-
new_name: string | null;
|
|
236
|
-
previous_go_id: string | null;
|
|
237
|
-
tts_name: string;
|
|
238
|
-
district_id: string;
|
|
239
|
-
latitude: number;
|
|
240
|
-
locality_id: string | null;
|
|
241
|
-
longitude: number;
|
|
242
|
-
municipality_id: string;
|
|
243
|
-
parish_id: string | null;
|
|
244
|
-
bench_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
|
|
245
|
-
electricity_status: "unknown" | "available" | "unavailable";
|
|
246
|
-
pole_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
|
|
247
|
-
road_type: "unknown" | "complementary_itinerary" | "highway" | "main_itinerary" | "national_road" | "regional_road" | "secondary_road";
|
|
248
|
-
shelter_code: string | null;
|
|
249
|
-
shelter_frame_size: [number, number] | null;
|
|
250
|
-
shelter_installation_date: import("@tmlmobilidade/types").UnixTimestamp | null;
|
|
251
|
-
shelter_maintainer: string | null;
|
|
252
|
-
shelter_make: string | null;
|
|
253
|
-
shelter_model: string | null;
|
|
254
|
-
shelter_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
|
|
255
|
-
last_infrastructure_check: import("@tmlmobilidade/types").UnixTimestamp | null;
|
|
256
|
-
last_infrastructure_maintenance: import("@tmlmobilidade/types").UnixTimestamp | null;
|
|
257
|
-
last_schedules_check: import("@tmlmobilidade/types").UnixTimestamp | null;
|
|
258
|
-
last_schedules_maintenance: import("@tmlmobilidade/types").UnixTimestamp | null;
|
|
259
|
-
connections: ("ferry" | "light_rail" | "subway" | "train" | "boat" | "airport" | "bike_sharing" | "bike_parking" | "car_parking")[];
|
|
260
|
-
facilities: ("fire_station" | "health_clinic" | "historic_building" | "hospital" | "police_station" | "school" | "shopping" | "transit_office" | "university" | "beach")[];
|
|
261
|
-
equipment: ("pip" | "mupi" | "mini_pip")[];
|
|
262
|
-
has_bench: "unknown" | "available" | "unavailable";
|
|
263
|
-
has_mupi: "unknown" | "available" | "unavailable";
|
|
264
|
-
has_network_map: "unknown" | "available" | "unavailable";
|
|
265
|
-
has_schedules: "unknown" | "available" | "unavailable";
|
|
266
|
-
has_shelter: "unknown" | "available" | "unavailable";
|
|
267
|
-
has_stop_sign: "unknown" | "available" | "unavailable";
|
|
268
|
-
observations: string | null;
|
|
269
|
-
is_deleted: boolean;
|
|
270
|
-
tts_hash: string;
|
|
271
|
-
file_ids: string[];
|
|
272
|
-
image_ids: string[];
|
|
273
|
-
updated_by?: string | undefined;
|
|
274
|
-
}>[]>;
|
|
275
|
-
/**
|
|
276
|
-
* Toogle the delete status of a document by its ID.
|
|
277
|
-
* Stop documents are never truly deleted to preserve
|
|
278
|
-
* data integrity and prevent ID reuse.
|
|
279
|
-
* @param id The ID of the stop document to delete.
|
|
280
|
-
* @param forceValue Optional boolean to explicitly set the deleted status.
|
|
281
|
-
* @returns A promise that resolves to the result of the delete operation.
|
|
282
|
-
*/
|
|
283
|
-
toggleDeleteById(id: number, forceValue?: boolean): Promise<void>;
|
|
284
|
-
protected getCollectionIndexes(): IndexDescription[];
|
|
285
|
-
protected getCollectionName(): string;
|
|
286
|
-
protected getEnvName(): string;
|
|
287
|
-
}
|
|
288
|
-
export declare const stops: StopsClass;
|
|
289
|
-
export {};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/* * */
|
|
2
|
-
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
3
|
-
import { CreateStopSchema, UpdateStopSchema } from '@tmlmobilidade/types';
|
|
4
|
-
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
5
|
-
/* * */
|
|
6
|
-
class StopsClass extends MongoCollectionClass {
|
|
7
|
-
static _instance;
|
|
8
|
-
createSchema = CreateStopSchema;
|
|
9
|
-
updateSchema = UpdateStopSchema;
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
}
|
|
13
|
-
static async getInstance() {
|
|
14
|
-
if (!StopsClass._instance) {
|
|
15
|
-
const instance = new StopsClass();
|
|
16
|
-
await instance.connect();
|
|
17
|
-
StopsClass._instance = instance;
|
|
18
|
-
}
|
|
19
|
-
return StopsClass._instance;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Override deleteById to prevent actual deletion of stop documents.
|
|
23
|
-
* Stops cannot be deleted, only archived.
|
|
24
|
-
* @param filter The filter used to select the document to "delete".
|
|
25
|
-
* @returns A promise that rejects with an error indicating deletion is not allowed.
|
|
26
|
-
*/
|
|
27
|
-
async deleteById() {
|
|
28
|
-
throw new Error('Method not implemented. Stops cannot be deleted, only archived.');
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Override deleteOne to prevent actual deletion of stop documents.
|
|
32
|
-
* Stops cannot be deleted, only archived.
|
|
33
|
-
* @param filter The filter used to select the document to "delete".
|
|
34
|
-
* @returns A promise that rejects with an error indicating deletion is not allowed.
|
|
35
|
-
*/
|
|
36
|
-
async deleteOne() {
|
|
37
|
-
throw new Error('Method not implemented. Stops cannot be deleted, only archived.');
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Override deleteMany to prevent actual deletion of stop documents.
|
|
41
|
-
* Stops cannot be deleted, only archived.
|
|
42
|
-
* @param filter The filter used to select the documents to "delete".
|
|
43
|
-
* @returns A promise that rejects with an error indicating deletion is not allowed.
|
|
44
|
-
*/
|
|
45
|
-
async deleteMany() {
|
|
46
|
-
throw new Error('Method not implemented. Stops cannot be deleted, only archived.');
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Finds stop documents by municipality ID with optional pagination and sorting.
|
|
50
|
-
* @param id The municipality ID to search for
|
|
51
|
-
* @param perPage Optional number of documents per page for pagination
|
|
52
|
-
* @param page Optional page number for pagination
|
|
53
|
-
* @param sort Optional sort specification
|
|
54
|
-
* @returns A promise that resolves to an array of matching stop documents
|
|
55
|
-
*/
|
|
56
|
-
async findByMunicipalityId(id, perPage, page, sort) {
|
|
57
|
-
const query = this.mongoCollection.find({ municipality_id: id });
|
|
58
|
-
if (perPage)
|
|
59
|
-
query.limit(perPage);
|
|
60
|
-
if (page && perPage)
|
|
61
|
-
query.skip(perPage * (page - 1));
|
|
62
|
-
if (sort)
|
|
63
|
-
query.sort(sort);
|
|
64
|
-
return query.toArray();
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Finds multiple stop documents by their IDs.
|
|
68
|
-
* @param ids Array of stop IDs to search for
|
|
69
|
-
* @returns A promise that resolves to an array of matching stop documents
|
|
70
|
-
*/
|
|
71
|
-
async findManyByIds(ids) {
|
|
72
|
-
return this.mongoCollection.find({ _id: { $in: ids } }).toArray();
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Toogle the delete status of a document by its ID.
|
|
76
|
-
* Stop documents are never truly deleted to preserve
|
|
77
|
-
* data integrity and prevent ID reuse.
|
|
78
|
-
* @param id The ID of the stop document to delete.
|
|
79
|
-
* @param forceValue Optional boolean to explicitly set the deleted status.
|
|
80
|
-
* @returns A promise that resolves to the result of the delete operation.
|
|
81
|
-
*/
|
|
82
|
-
async toggleDeleteById(id, forceValue) {
|
|
83
|
-
// Get the current document from the database
|
|
84
|
-
const foundDoc = await this.findById(id);
|
|
85
|
-
if (!foundDoc)
|
|
86
|
-
throw new Error('Stop not found');
|
|
87
|
-
// Determine the new deleted status
|
|
88
|
-
const newDeletedStatus = forceValue !== undefined ? forceValue : !foundDoc.is_deleted;
|
|
89
|
-
// If the document is deleted, we allow the operation even if it's locked
|
|
90
|
-
await this.updateById(id, { is_deleted: newDeletedStatus }, { forceIfLocked: !newDeletedStatus && foundDoc.is_locked });
|
|
91
|
-
}
|
|
92
|
-
getCollectionIndexes() {
|
|
93
|
-
return [
|
|
94
|
-
{ background: true, key: { name: 1 } },
|
|
95
|
-
];
|
|
96
|
-
}
|
|
97
|
-
getCollectionName() {
|
|
98
|
-
return 'stops';
|
|
99
|
-
}
|
|
100
|
-
getEnvName() {
|
|
101
|
-
return 'DATABASE_URI';
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
/* * */
|
|
105
|
-
export const stops = asyncSingletonProxy(StopsClass);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './vehicles.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './vehicles.js';
|
|
@@ -1,16 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,34 +0,0 @@
|
|
|
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);
|