@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.
Files changed (39) hide show
  1. package/dist/interfaces/agencies/agencies.d.ts +2 -2
  2. package/dist/interfaces/alerts/alerts.d.ts +21 -18
  3. package/dist/interfaces/auth/roles.d.ts +126 -24
  4. package/dist/interfaces/auth/users.d.ts +168 -32
  5. package/dist/interfaces/auth/verification-tokens.d.ts +1 -1
  6. package/dist/interfaces/dates/annotations.d.ts +1 -1
  7. package/dist/interfaces/dates/index.d.ts +1 -0
  8. package/dist/interfaces/dates/index.js +1 -0
  9. package/dist/interfaces/dates/periods.d.ts +38 -0
  10. package/dist/interfaces/dates/periods.js +41 -0
  11. package/dist/interfaces/gtfs-validations/gtfs-validations.d.ts +2 -2
  12. package/dist/interfaces/index.d.ts +3 -0
  13. package/dist/interfaces/index.js +3 -0
  14. package/dist/interfaces/offer/index.d.ts +4 -0
  15. package/dist/interfaces/offer/index.js +4 -0
  16. package/dist/interfaces/offer/lines.d.ts +50 -0
  17. package/dist/interfaces/offer/lines.js +41 -0
  18. package/dist/interfaces/offer/patterns.d.ts +176 -0
  19. package/dist/interfaces/offer/patterns.js +41 -0
  20. package/dist/interfaces/offer/routes.d.ts +45 -0
  21. package/dist/interfaces/offer/routes.js +41 -0
  22. package/dist/interfaces/offer/typologies.d.ts +41 -0
  23. package/dist/interfaces/offer/typologies.js +41 -0
  24. package/dist/interfaces/plans/plans.d.ts +1 -1
  25. package/dist/interfaces/rides/pipelines.d.ts +8 -7
  26. package/dist/interfaces/rides/pipelines.js +56 -25
  27. package/dist/interfaces/rides/rides.d.ts +6 -6
  28. package/dist/interfaces/stops/stops.d.ts +8 -8
  29. package/dist/interfaces/ticketing/fares.d.ts +41 -0
  30. package/dist/interfaces/ticketing/fares.js +41 -0
  31. package/dist/interfaces/ticketing/index.d.ts +1 -0
  32. package/dist/interfaces/ticketing/index.js +1 -0
  33. package/dist/interfaces/vehicles/index.d.ts +1 -0
  34. package/dist/interfaces/vehicles/index.js +1 -0
  35. package/dist/interfaces/vehicles/vehicles.d.ts +16 -0
  36. package/dist/interfaces/vehicles/vehicles.js +34 -0
  37. package/dist/interfaces/zones/zones.d.ts +69 -3
  38. package/dist/providers/storage/storage.factory.js +0 -1
  39. package/package.json +4 -4
@@ -19,6 +19,7 @@ declare class AnnotationsClass extends MongoCollectionClass<Annotation, CreateAn
19
19
  created_at: number & {
20
20
  __brand: "UnixTimestamp";
21
21
  };
22
+ created_by: string | null;
22
23
  is_locked: boolean;
23
24
  updated_at: number & {
24
25
  __brand: "UnixTimestamp";
@@ -26,7 +27,6 @@ declare class AnnotationsClass extends MongoCollectionClass<Annotation, CreateAn
26
27
  title: string;
27
28
  agency_ids: string[];
28
29
  dates: import("@tmlmobilidade/types").OperationalDate[];
29
- created_by?: string | undefined;
30
30
  updated_by?: string | undefined;
31
31
  description?: string | undefined;
32
32
  }>[]>;
@@ -1 +1,2 @@
1
1
  export * from './annotations.js';
2
+ export * from './periods.js';
@@ -1 +1,2 @@
1
1
  export * from './annotations.js';
2
+ export * from './periods.js';
@@ -0,0 +1,38 @@
1
+ import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
+ import { type CreatePeriodDto, type Period, type UpdatePeriodDto } from '@tmlmobilidade/types';
3
+ import { IndexDescription } from 'mongodb';
4
+ import { z } from 'zod';
5
+ declare class PeriodsClass extends MongoCollectionClass<Period, CreatePeriodDto, UpdatePeriodDto> {
6
+ private static _instance;
7
+ protected createSchema: z.ZodSchema;
8
+ protected updateSchema: z.ZodSchema;
9
+ private constructor();
10
+ static getInstance(): Promise<PeriodsClass>;
11
+ /**
12
+ * Finds Period documents by agency ID.
13
+ *
14
+ * @param id - The agency ID to search for
15
+ * @returns A promise that resolves to an array of matching documents
16
+ */
17
+ findByAgencyId(id: 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
+ name: string;
28
+ updated_by?: string | undefined;
29
+ agency_id?: string | undefined;
30
+ color?: string | undefined;
31
+ dates?: import("@tmlmobilidade/types").OperationalDate[] | undefined;
32
+ }>[]>;
33
+ protected getCollectionIndexes(): IndexDescription[];
34
+ protected getCollectionName(): string;
35
+ protected getEnvName(): string;
36
+ }
37
+ export declare const periods: PeriodsClass;
38
+ export {};
@@ -0,0 +1,41 @@
1
+ /* * */
2
+ import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
+ import { PeriodSchema, UpdatePeriodSchema } from '@tmlmobilidade/types';
4
+ import { AsyncSingletonProxy } from '@tmlmobilidade/utils';
5
+ /* * */
6
+ class PeriodsClass extends MongoCollectionClass {
7
+ static _instance;
8
+ createSchema = PeriodSchema;
9
+ updateSchema = UpdatePeriodSchema;
10
+ constructor() {
11
+ super();
12
+ }
13
+ static async getInstance() {
14
+ if (!PeriodsClass._instance) {
15
+ const instance = new PeriodsClass();
16
+ await instance.connect();
17
+ PeriodsClass._instance = instance;
18
+ }
19
+ return PeriodsClass._instance;
20
+ }
21
+ /**
22
+ * Finds Period documents by agency ID.
23
+ *
24
+ * @param id - The agency ID to search for
25
+ * @returns A promise that resolves to an array of matching documents
26
+ */
27
+ async findByAgencyId(id) {
28
+ return this.mongoCollection.find({ agency_id: id }).toArray();
29
+ }
30
+ getCollectionIndexes() {
31
+ return [];
32
+ }
33
+ getCollectionName() {
34
+ return 'periods';
35
+ }
36
+ getEnvName() {
37
+ return 'DATABASE_URI';
38
+ }
39
+ }
40
+ /* * */
41
+ export const periods = AsyncSingletonProxy(PeriodsClass);
@@ -18,6 +18,7 @@ declare class GtfValidationsClass extends MongoCollectionClass<GtfsValidation, C
18
18
  created_at: number & {
19
19
  __brand: "UnixTimestamp";
20
20
  };
21
+ created_by: string | null;
21
22
  is_locked: boolean;
22
23
  updated_at: number & {
23
24
  __brand: "UnixTimestamp";
@@ -46,7 +47,6 @@ declare class GtfValidationsClass extends MongoCollectionClass<GtfsValidation, C
46
47
  feed_version?: string | null | undefined;
47
48
  };
48
49
  notification_sent: boolean;
49
- created_by?: string | undefined;
50
50
  updated_by?: string | undefined;
51
51
  summary?: {
52
52
  messages: {
@@ -55,7 +55,7 @@ declare class GtfValidationsClass extends MongoCollectionClass<GtfsValidation, C
55
55
  validation_id: string;
56
56
  file_name: string;
57
57
  rows: number[];
58
- severity: "error" | "warning" | "ignore" | "forbidden";
58
+ severity: "error" | "ignore" | "warning" | "forbidden";
59
59
  }[];
60
60
  total_errors: number;
61
61
  total_warnings: number;
@@ -8,6 +8,7 @@ export * from './gtfs-validations/index.js';
8
8
  export * from './locations/index.js';
9
9
  export * from './metrics/index.js';
10
10
  export * from './notifications/index.js';
11
+ export * from './offer/index.js';
11
12
  export * from './organizations/index.js';
12
13
  export * from './pcgidb/index.js';
13
14
  export * from './plans/index.js';
@@ -16,5 +17,7 @@ export * from './rides/index.js';
16
17
  export * from './sams/index.js';
17
18
  export * from './simplified-apex/index.js';
18
19
  export * from './stops/index.js';
20
+ export * from './ticketing/index.js';
19
21
  export * from './vehicle-events/index.js';
22
+ export * from './vehicles/index.js';
20
23
  export * from './zones/index.js';
@@ -8,6 +8,7 @@ export * from './gtfs-validations/index.js';
8
8
  export * from './locations/index.js';
9
9
  export * from './metrics/index.js';
10
10
  export * from './notifications/index.js';
11
+ export * from './offer/index.js';
11
12
  export * from './organizations/index.js';
12
13
  export * from './pcgidb/index.js';
13
14
  export * from './plans/index.js';
@@ -16,5 +17,7 @@ export * from './rides/index.js';
16
17
  export * from './sams/index.js';
17
18
  export * from './simplified-apex/index.js';
18
19
  export * from './stops/index.js';
20
+ export * from './ticketing/index.js';
19
21
  export * from './vehicle-events/index.js';
22
+ export * from './vehicles/index.js';
20
23
  export * from './zones/index.js';
@@ -0,0 +1,4 @@
1
+ export * from './lines.js';
2
+ export * from './patterns.js';
3
+ export * from './routes.js';
4
+ export * from './typologies.js';
@@ -0,0 +1,4 @@
1
+ export * from './lines.js';
2
+ export * from './patterns.js';
3
+ export * from './routes.js';
4
+ export * from './typologies.js';
@@ -0,0 +1,50 @@
1
+ import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
+ import { type CreateLineDto, type Line, type UpdateLineDto } from '@tmlmobilidade/types';
3
+ import { IndexDescription } from 'mongodb';
4
+ import { z } from 'zod';
5
+ declare class LinesClass extends MongoCollectionClass<Line, CreateLineDto, UpdateLineDto> {
6
+ private static _instance;
7
+ protected createSchema: z.ZodSchema;
8
+ protected updateSchema: z.ZodSchema;
9
+ private constructor();
10
+ static getInstance(): Promise<LinesClass>;
11
+ /**
12
+ * Finds Line 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
+ agency_id: string;
30
+ interchange: "0" | "1" | "2";
31
+ is_circular_line: boolean;
32
+ is_continuous_line: boolean;
33
+ is_school_line: boolean;
34
+ onboard_fare_ids: string[] | null;
35
+ prepaid_fare_id: string | null;
36
+ transport_type: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "11" | "12";
37
+ typology: string | null;
38
+ updated_by?: string | undefined;
39
+ routes?: {
40
+ _id: string;
41
+ code: string;
42
+ name: string;
43
+ }[] | undefined;
44
+ }>[]>;
45
+ protected getCollectionIndexes(): IndexDescription[];
46
+ protected getCollectionName(): string;
47
+ protected getEnvName(): string;
48
+ }
49
+ export declare const lines: LinesClass;
50
+ export {};
@@ -0,0 +1,41 @@
1
+ /* * */
2
+ import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
+ import { CreateLineSchema, UpdateLineSchema } from '@tmlmobilidade/types';
4
+ import { AsyncSingletonProxy } from '@tmlmobilidade/utils';
5
+ /* * */
6
+ class LinesClass extends MongoCollectionClass {
7
+ static _instance;
8
+ createSchema = CreateLineSchema;
9
+ updateSchema = UpdateLineSchema;
10
+ constructor() {
11
+ super();
12
+ }
13
+ static async getInstance() {
14
+ if (!LinesClass._instance) {
15
+ const instance = new LinesClass();
16
+ await instance.connect();
17
+ LinesClass._instance = instance;
18
+ }
19
+ return LinesClass._instance;
20
+ }
21
+ /**
22
+ * Finds Line 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_id: { $in: ids } }).toArray();
29
+ }
30
+ getCollectionIndexes() {
31
+ return [];
32
+ }
33
+ getCollectionName() {
34
+ return 'lines';
35
+ }
36
+ getEnvName() {
37
+ return 'DATABASE_URI';
38
+ }
39
+ }
40
+ /* * */
41
+ export const lines = AsyncSingletonProxy(LinesClass);
@@ -0,0 +1,176 @@
1
+ import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
+ import { type CreatePatternDto, type Pattern, type UpdatePatternDto } from '@tmlmobilidade/types';
3
+ import { IndexDescription } from 'mongodb';
4
+ import { z } from 'zod';
5
+ declare class PatternsClass extends MongoCollectionClass<Pattern, CreatePatternDto, UpdatePatternDto> {
6
+ private static _instance;
7
+ protected createSchema: z.ZodSchema;
8
+ protected updateSchema: z.ZodSchema;
9
+ private constructor();
10
+ static getInstance(): Promise<PatternsClass>;
11
+ /**
12
+ * Finds Pattern documents by line ID.
13
+ *
14
+ * @param lineId - The line ID to search for
15
+ * @returns A promise that resolves to an array of matching documents
16
+ */
17
+ findByLineId(lineId: 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
+ line_id: string;
29
+ headsign: string;
30
+ route_id: string;
31
+ destination: string;
32
+ direction: "0" | "1";
33
+ origin: string;
34
+ rules: {
35
+ operatingMode: import("@tmlmobilidade/types").OPERATING_MODE;
36
+ timePoints: string[];
37
+ _id?: string | undefined;
38
+ name?: string | undefined;
39
+ periodIds?: string[] | undefined;
40
+ weekdays?: (1 | 2 | 3 | 5 | 4 | 6 | 7)[] | undefined;
41
+ holidays?: {
42
+ mode: "ignore";
43
+ } | {
44
+ mode: "all";
45
+ } | {
46
+ mode: "specific";
47
+ ids: string[];
48
+ } | undefined;
49
+ events?: string[] | undefined;
50
+ travelTime?: string | undefined;
51
+ }[];
52
+ updated_by?: string | undefined;
53
+ path?: {
54
+ _id: string;
55
+ stop_id: string;
56
+ allow_drop_off: boolean;
57
+ allow_pickup: boolean;
58
+ distance_delta: number | null;
59
+ timepoint: boolean;
60
+ zones?: string[] | undefined;
61
+ stop?: {
62
+ _id: string;
63
+ created_at: number & {
64
+ __brand: "UnixTimestamp";
65
+ };
66
+ created_by: string | null;
67
+ is_locked: boolean;
68
+ updated_at: number & {
69
+ __brand: "UnixTimestamp";
70
+ };
71
+ name: string;
72
+ short_name: string;
73
+ latitude: number;
74
+ longitude: number;
75
+ comments: ({
76
+ created_at: number & {
77
+ __brand: "UnixTimestamp";
78
+ };
79
+ created_by: string | null;
80
+ updated_at: number & {
81
+ __brand: "UnixTimestamp";
82
+ };
83
+ message: string;
84
+ type: "note";
85
+ _id?: string | undefined;
86
+ updated_by?: string | undefined;
87
+ } | {
88
+ created_at: number & {
89
+ __brand: "UnixTimestamp";
90
+ };
91
+ created_by: string | null;
92
+ updated_at: number & {
93
+ __brand: "UnixTimestamp";
94
+ };
95
+ type: "field_changed";
96
+ field: string;
97
+ _id?: string | undefined;
98
+ updated_by?: string | undefined;
99
+ metadata?: Record<string, unknown> | null | undefined;
100
+ curr_value?: any;
101
+ prev_value?: any;
102
+ } | {
103
+ created_at: number & {
104
+ __brand: "UnixTimestamp";
105
+ };
106
+ created_by: string | null;
107
+ updated_at: number & {
108
+ __brand: "UnixTimestamp";
109
+ };
110
+ type: "crud";
111
+ action: "create" | "update" | "delete" | "archive" | "restore";
112
+ _id?: string | undefined;
113
+ updated_by?: string | undefined;
114
+ })[];
115
+ has_bench: "unknown" | "available" | "unavailable";
116
+ has_network_map: "unknown" | "available" | "unavailable";
117
+ has_schedules: "unknown" | "available" | "unavailable";
118
+ has_shelter: "unknown" | "available" | "unavailable";
119
+ has_stop_sign: "unknown" | "available" | "unavailable";
120
+ municipality_id: string;
121
+ parish_id: string | null;
122
+ shelter_code: string | null;
123
+ shelter_maintainer: string | null;
124
+ is_deleted: boolean;
125
+ jurisdiction: "unknown" | "ip" | "municipality" | "other";
126
+ legacy_id: string | null;
127
+ lifecycle_status: "draft" | "active" | "inactive" | "provisional" | "seasonal" | "voided";
128
+ new_name: string | null;
129
+ tts_name: string;
130
+ district_id: string;
131
+ locality_id: string | null;
132
+ bench_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
133
+ electricity_status: "unknown" | "available" | "unavailable";
134
+ pole_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
135
+ road_type: "unknown" | "complementary_itinerary" | "highway" | "main_itinerary" | "national_road" | "regional_road" | "secondary_road";
136
+ shelter_frame_size: [number, number] | null;
137
+ shelter_installation_date: import("@tmlmobilidade/types").UnixTimestamp | null;
138
+ shelter_make: string | null;
139
+ shelter_model: string | null;
140
+ shelter_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
141
+ last_infrastructure_check: import("@tmlmobilidade/types").UnixTimestamp | null;
142
+ last_infrastructure_maintenance: import("@tmlmobilidade/types").UnixTimestamp | null;
143
+ last_schedules_check: import("@tmlmobilidade/types").UnixTimestamp | null;
144
+ last_schedules_maintenance: import("@tmlmobilidade/types").UnixTimestamp | null;
145
+ connections: ("ferry" | "light_rail" | "subway" | "train" | "boat" | "airport" | "bike_sharing" | "bike_parking" | "car_parking")[];
146
+ facilities: ("school" | "fire_station" | "health_clinic" | "historic_building" | "hospital" | "police_station" | "shopping" | "transit_office" | "university" | "beach")[];
147
+ equipment: ("pip" | "mupi" | "mini_pip")[];
148
+ has_mupi: "unknown" | "available" | "unavailable";
149
+ file_ids: string[];
150
+ image_ids: string[];
151
+ observations: string | null;
152
+ updated_by?: string | undefined;
153
+ } | null | undefined;
154
+ }[] | undefined;
155
+ shape?: {
156
+ geojson: {
157
+ type: string;
158
+ geometry: {
159
+ type: string;
160
+ coordinates: number[][];
161
+ };
162
+ properties?: {} | undefined;
163
+ };
164
+ extension: number;
165
+ } | undefined;
166
+ presets?: {
167
+ dwell_time: number;
168
+ velocity: number;
169
+ } | undefined;
170
+ }>[]>;
171
+ protected getCollectionIndexes(): IndexDescription[];
172
+ protected getCollectionName(): string;
173
+ protected getEnvName(): string;
174
+ }
175
+ export declare const patterns: PatternsClass;
176
+ export {};
@@ -0,0 +1,41 @@
1
+ /* * */
2
+ import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
+ import { CreatePatternSchema, UpdatePatternSchema } from '@tmlmobilidade/types';
4
+ import { AsyncSingletonProxy } from '@tmlmobilidade/utils';
5
+ /* * */
6
+ class PatternsClass extends MongoCollectionClass {
7
+ static _instance;
8
+ createSchema = CreatePatternSchema;
9
+ updateSchema = UpdatePatternSchema;
10
+ constructor() {
11
+ super();
12
+ }
13
+ static async getInstance() {
14
+ if (!PatternsClass._instance) {
15
+ const instance = new PatternsClass();
16
+ await instance.connect();
17
+ PatternsClass._instance = instance;
18
+ }
19
+ return PatternsClass._instance;
20
+ }
21
+ /**
22
+ * Finds Pattern documents by line ID.
23
+ *
24
+ * @param lineId - The line ID to search for
25
+ * @returns A promise that resolves to an array of matching documents
26
+ */
27
+ async findByLineId(lineId) {
28
+ return this.mongoCollection.find({ line_id: lineId }).toArray();
29
+ }
30
+ getCollectionIndexes() {
31
+ return [];
32
+ }
33
+ getCollectionName() {
34
+ return 'patterns';
35
+ }
36
+ getEnvName() {
37
+ return 'DATABASE_URI';
38
+ }
39
+ }
40
+ /* * */
41
+ export const patterns = AsyncSingletonProxy(PatternsClass);
@@ -0,0 +1,45 @@
1
+ import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
+ import { type CreateRouteDto, type Route, type UpdateRouteDto } from '@tmlmobilidade/types';
3
+ import { IndexDescription } from 'mongodb';
4
+ import { z } from 'zod';
5
+ declare class RoutesClass extends MongoCollectionClass<Route, CreateRouteDto, UpdateRouteDto> {
6
+ private static _instance;
7
+ protected createSchema: z.ZodSchema;
8
+ protected updateSchema: z.ZodSchema;
9
+ private constructor();
10
+ static getInstance(): Promise<RoutesClass>;
11
+ /**
12
+ * Finds Route documents by line ID.
13
+ *
14
+ * @param lineId - The line ID to search for
15
+ * @returns A promise that resolves to an array of matching documents
16
+ */
17
+ findByLineId(lineId: 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
+ line_id: string;
30
+ path_type: "0" | "1" | "2";
31
+ updated_by?: string | undefined;
32
+ patterns?: {
33
+ _id: string;
34
+ code: string;
35
+ line_id: string;
36
+ headsign: string;
37
+ route_id: string;
38
+ }[] | undefined;
39
+ }>[]>;
40
+ protected getCollectionIndexes(): IndexDescription[];
41
+ protected getCollectionName(): string;
42
+ protected getEnvName(): string;
43
+ }
44
+ export declare const routes: RoutesClass;
45
+ export {};
@@ -0,0 +1,41 @@
1
+ /* * */
2
+ import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
+ import { CreateRouteSchema, UpdateRouteSchema } from '@tmlmobilidade/types';
4
+ import { AsyncSingletonProxy } from '@tmlmobilidade/utils';
5
+ /* * */
6
+ class RoutesClass extends MongoCollectionClass {
7
+ static _instance;
8
+ createSchema = CreateRouteSchema;
9
+ updateSchema = UpdateRouteSchema;
10
+ constructor() {
11
+ super();
12
+ }
13
+ static async getInstance() {
14
+ if (!RoutesClass._instance) {
15
+ const instance = new RoutesClass();
16
+ await instance.connect();
17
+ RoutesClass._instance = instance;
18
+ }
19
+ return RoutesClass._instance;
20
+ }
21
+ /**
22
+ * Finds Route documents by line ID.
23
+ *
24
+ * @param lineId - The line ID to search for
25
+ * @returns A promise that resolves to an array of matching documents
26
+ */
27
+ async findByLineId(lineId) {
28
+ return this.mongoCollection.find({ line_id: lineId }).toArray();
29
+ }
30
+ getCollectionIndexes() {
31
+ return [];
32
+ }
33
+ getCollectionName() {
34
+ return 'routes';
35
+ }
36
+ getEnvName() {
37
+ return 'DATABASE_URI';
38
+ }
39
+ }
40
+ /* * */
41
+ export const routes = AsyncSingletonProxy(RoutesClass);
@@ -0,0 +1,41 @@
1
+ import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
+ import { type CreateTypologyDto, type Typology, type UpdateTypologyDto } from '@tmlmobilidade/types';
3
+ import { IndexDescription } from 'mongodb';
4
+ import { z } from 'zod';
5
+ declare class TypologiesClass extends MongoCollectionClass<Typology, CreateTypologyDto, UpdateTypologyDto> {
6
+ private static _instance;
7
+ protected createSchema: z.ZodSchema;
8
+ protected updateSchema: z.ZodSchema;
9
+ private constructor();
10
+ static getInstance(): Promise<TypologiesClass>;
11
+ /**
12
+ * Finds Typology 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
+ agency_ids: string[];
30
+ color: string;
31
+ default_onboard_fare_ids: string[] | null;
32
+ default_prepaid_fare_id: string | null;
33
+ text_color: string;
34
+ updated_by?: string | undefined;
35
+ }>[]>;
36
+ protected getCollectionIndexes(): IndexDescription[];
37
+ protected getCollectionName(): string;
38
+ protected getEnvName(): string;
39
+ }
40
+ export declare const typologies: TypologiesClass;
41
+ export {};
@@ -0,0 +1,41 @@
1
+ /* * */
2
+ import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
+ import { CreateTypologySchema, UpdateTypologySchema } from '@tmlmobilidade/types';
4
+ import { AsyncSingletonProxy } from '@tmlmobilidade/utils';
5
+ /* * */
6
+ class TypologiesClass extends MongoCollectionClass {
7
+ static _instance;
8
+ createSchema = CreateTypologySchema;
9
+ updateSchema = UpdateTypologySchema;
10
+ constructor() {
11
+ super();
12
+ }
13
+ static async getInstance() {
14
+ if (!TypologiesClass._instance) {
15
+ const instance = new TypologiesClass();
16
+ await instance.connect();
17
+ TypologiesClass._instance = instance;
18
+ }
19
+ return TypologiesClass._instance;
20
+ }
21
+ /**
22
+ * Finds Typology 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 'typologies';
35
+ }
36
+ getEnvName() {
37
+ return 'DATABASE_URI';
38
+ }
39
+ }
40
+ /* * */
41
+ export const typologies = AsyncSingletonProxy(TypologiesClass);
@@ -19,6 +19,7 @@ declare class PlansClass extends MongoCollectionClass<Plan, CreatePlanDto, Updat
19
19
  created_at: number & {
20
20
  __brand: "UnixTimestamp";
21
21
  };
22
+ created_by: string | null;
22
23
  is_locked: boolean;
23
24
  updated_at: number & {
24
25
  __brand: "UnixTimestamp";
@@ -61,7 +62,6 @@ declare class PlansClass extends MongoCollectionClass<Plan, CreatePlanDto, Updat
61
62
  pcgi_legacy: {
62
63
  operation_plan_id: string | null;
63
64
  };
64
- created_by?: string | undefined;
65
65
  updated_by?: string | undefined;
66
66
  }>[]>;
67
67
  protected getCollectionIndexes(): IndexDescription[];