@tmlmobilidade/interfaces 20251217.1540.37 → 20251218.110.37

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.
@@ -0,0 +1,38 @@
1
+ import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
+ import { type Annotation, type CreateAnnotationDto, type UpdateAnnotationDto } from '@tmlmobilidade/types';
3
+ import { IndexDescription } from 'mongodb';
4
+ import { z } from 'zod';
5
+ declare class AnnotationsClass extends MongoCollectionClass<Annotation, CreateAnnotationDto, UpdateAnnotationDto> {
6
+ private static _instance;
7
+ protected createSchema: z.ZodSchema;
8
+ protected updateSchema: z.ZodSchema;
9
+ private constructor();
10
+ static getInstance(): Promise<AnnotationsClass>;
11
+ /**
12
+ * Finds Annotation 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
+ is_locked: boolean;
23
+ updated_at: number & {
24
+ __brand: "UnixTimestamp";
25
+ };
26
+ title: string;
27
+ agency_ids: string[];
28
+ dates: import("@tmlmobilidade/types").OperationalDate[];
29
+ created_by?: string | undefined;
30
+ updated_by?: string | undefined;
31
+ description?: string | undefined;
32
+ }>[]>;
33
+ protected getCollectionIndexes(): IndexDescription[];
34
+ protected getCollectionName(): string;
35
+ protected getEnvName(): string;
36
+ }
37
+ export declare const annotations: AnnotationsClass;
38
+ export {};
@@ -0,0 +1,41 @@
1
+ /* * */
2
+ import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
+ import { AnnotationSchema, UpdateAnnotationSchema } from '@tmlmobilidade/types';
4
+ import { AsyncSingletonProxy } from '@tmlmobilidade/utils';
5
+ /* * */
6
+ class AnnotationsClass extends MongoCollectionClass {
7
+ static _instance;
8
+ createSchema = AnnotationSchema;
9
+ updateSchema = UpdateAnnotationSchema;
10
+ constructor() {
11
+ super();
12
+ }
13
+ static async getInstance() {
14
+ if (!AnnotationsClass._instance) {
15
+ const instance = new AnnotationsClass();
16
+ await instance.connect();
17
+ AnnotationsClass._instance = instance;
18
+ }
19
+ return AnnotationsClass._instance;
20
+ }
21
+ /**
22
+ * Finds Annotation 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 'annotations';
35
+ }
36
+ getEnvName() {
37
+ return 'DATABASE_URI';
38
+ }
39
+ }
40
+ /* * */
41
+ export const annotations = AsyncSingletonProxy(AnnotationsClass);
@@ -0,0 +1 @@
1
+ export * from './annotations.js';
@@ -0,0 +1 @@
1
+ export * from './annotations.js';
@@ -19,6 +19,7 @@ declare class GtfValidationsClass extends MongoCollectionClass<GtfsValidation, C
19
19
  created_at: number & {
20
20
  __brand: "UnixTimestamp";
21
21
  };
22
+ is_locked: boolean;
22
23
  updated_at: number & {
23
24
  __brand: "UnixTimestamp";
24
25
  };
@@ -1,6 +1,7 @@
1
1
  export * from './agencies/index.js';
2
2
  export * from './alerts/index.js';
3
3
  export * from './auth/index.js';
4
+ export * from './dates/index.js';
4
5
  export * from './file-exports/index.js';
5
6
  export * from './files/index.js';
6
7
  export * from './gtfs-validations/index.js';
@@ -1,6 +1,7 @@
1
1
  export * from './agencies/index.js';
2
2
  export * from './alerts/index.js';
3
3
  export * from './auth/index.js';
4
+ export * from './dates/index.js';
4
5
  export * from './file-exports/index.js';
5
6
  export * from './files/index.js';
6
7
  export * from './gtfs-validations/index.js';
@@ -105,7 +105,7 @@ class LocationsClass {
105
105
  const locality = await this.findLocalitiesByGeo(lat, lon, { projection: { _id: 1, properties: 1 } });
106
106
  const _census = census ? await this.findCensusByGeo(lat, lon, { projection: { _id: 1, properties: 1 } }) : undefined;
107
107
  return {
108
- census: { ..._census.properties, _id: _census._id },
108
+ census: { ..._census?.properties, _id: _census?._id },
109
109
  district: district,
110
110
  latitude: lat,
111
111
  locality: locality,
@@ -159,7 +159,7 @@ class LocationsClass {
159
159
  } : undefined;
160
160
  return {
161
161
  _id: doc._id,
162
- ...doc.properties,
162
+ ...doc?.properties,
163
163
  geojson,
164
164
  };
165
165
  }
@@ -1,11 +1,11 @@
1
1
  /* * */
2
2
  import { MongoCollectionClass } from '../../common/mongo-collection.js';
3
- import { CreateOrganizationSchema, OrganizationSchema, UpdateOrganizationSchema } from '@tmlmobilidade/types';
3
+ import { OrganizationSchema, UpdateOrganizationSchema } from '@tmlmobilidade/types';
4
4
  import { AsyncSingletonProxy } from '@tmlmobilidade/utils';
5
5
  /* * */
6
6
  class OrganizationsClass extends MongoCollectionClass {
7
7
  static _instance;
8
- createSchema = CreateOrganizationSchema;
8
+ createSchema = OrganizationSchema;
9
9
  updateSchema = UpdateOrganizationSchema;
10
10
  constructor() {
11
11
  super();
@@ -24,7 +24,6 @@ class PCGIDBLegacyClass {
24
24
  // Get the database URI from environment variables
25
25
  const mongoClientOptions = {
26
26
  connectTimeoutMS: 10_000,
27
- // directConnection: true,
28
27
  maxPoolSize: 20,
29
28
  minPoolSize: 2,
30
29
  readPreference: 'secondaryPreferred',
@@ -21,7 +21,6 @@ class PCGIDBTicketingClass {
21
21
  // Get the database URI from environment variables
22
22
  const mongoClientOptions = {
23
23
  connectTimeoutMS: 10_000,
24
- // directConnection: true,
25
24
  maxPoolSize: 20,
26
25
  minPoolSize: 2,
27
26
  readPreference: 'secondaryPreferred',
@@ -22,7 +22,6 @@ class PCGIDBValidationsClass {
22
22
  // Get the database URI from environment variables
23
23
  const mongoClientOptions = {
24
24
  connectTimeoutMS: 10_000,
25
- // directConnection: true,
26
25
  maxPoolSize: 20,
27
26
  minPoolSize: 2,
28
27
  readPreference: 'secondaryPreferred',
@@ -19,10 +19,10 @@ declare class PlansClass extends MongoCollectionClass<Plan, CreatePlanDto, Updat
19
19
  created_at: number & {
20
20
  __brand: "UnixTimestamp";
21
21
  };
22
+ is_locked: boolean;
22
23
  updated_at: number & {
23
24
  __brand: "UnixTimestamp";
24
25
  };
25
- is_locked: boolean;
26
26
  gtfs_agency: {
27
27
  agency_id: string;
28
28
  agency_name: string;
@@ -26,6 +26,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
26
26
  line_id: number;
27
27
  pattern_id: string;
28
28
  trip_id: string;
29
+ seen_last_at: import("@tmlmobilidade/types").UnixTimestamp | null;
29
30
  driver_ids: string[];
30
31
  headsign: string;
31
32
  plan_id: string;
@@ -45,7 +46,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
45
46
  extension_observed: number | null;
46
47
  extension_scheduled: number;
47
48
  seen_first_at: import("@tmlmobilidade/types").UnixTimestamp | null;
48
- seen_last_at: import("@tmlmobilidade/types").UnixTimestamp | null;
49
49
  passengers_estimated: number | null;
50
50
  passengers_observed: number | null;
51
51
  passengers_observed_on_board_sales_amount: number | null;
@@ -175,6 +175,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
175
175
  line_id: number;
176
176
  pattern_id: string;
177
177
  trip_id: string;
178
+ seen_last_at: import("@tmlmobilidade/types").UnixTimestamp | null;
178
179
  driver_ids: string[];
179
180
  headsign: string;
180
181
  plan_id: string;
@@ -194,7 +195,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
194
195
  extension_observed: number | null;
195
196
  extension_scheduled: number;
196
197
  seen_first_at: import("@tmlmobilidade/types").UnixTimestamp | null;
197
- seen_last_at: import("@tmlmobilidade/types").UnixTimestamp | null;
198
198
  passengers_estimated: number | null;
199
199
  passengers_observed: number | null;
200
200
  passengers_observed_on_board_sales_amount: number | null;
@@ -324,6 +324,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
324
324
  line_id: number;
325
325
  pattern_id: string;
326
326
  trip_id: string;
327
+ seen_last_at: import("@tmlmobilidade/types").UnixTimestamp | null;
327
328
  driver_ids: string[];
328
329
  headsign: string;
329
330
  plan_id: string;
@@ -343,7 +344,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
343
344
  extension_observed: number | null;
344
345
  extension_scheduled: number;
345
346
  seen_first_at: import("@tmlmobilidade/types").UnixTimestamp | null;
346
- seen_last_at: import("@tmlmobilidade/types").UnixTimestamp | null;
347
347
  passengers_estimated: number | null;
348
348
  passengers_observed: number | null;
349
349
  passengers_observed_on_board_sales_amount: number | null;
@@ -473,6 +473,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
473
473
  line_id: number;
474
474
  pattern_id: string;
475
475
  trip_id: string;
476
+ seen_last_at: import("@tmlmobilidade/types").UnixTimestamp | null;
476
477
  driver_ids: string[];
477
478
  headsign: string;
478
479
  plan_id: string;
@@ -492,7 +493,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
492
493
  extension_observed: number | null;
493
494
  extension_scheduled: number;
494
495
  seen_first_at: import("@tmlmobilidade/types").UnixTimestamp | null;
495
- seen_last_at: import("@tmlmobilidade/types").UnixTimestamp | null;
496
496
  passengers_estimated: number | null;
497
497
  passengers_observed: number | null;
498
498
  passengers_observed_on_board_sales_amount: number | null;
@@ -622,6 +622,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
622
622
  line_id: number;
623
623
  pattern_id: string;
624
624
  trip_id: string;
625
+ seen_last_at: import("@tmlmobilidade/types").UnixTimestamp | null;
625
626
  driver_ids: string[];
626
627
  headsign: string;
627
628
  plan_id: string;
@@ -641,7 +642,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
641
642
  extension_observed: number | null;
642
643
  extension_scheduled: number;
643
644
  seen_first_at: import("@tmlmobilidade/types").UnixTimestamp | null;
644
- seen_last_at: import("@tmlmobilidade/types").UnixTimestamp | null;
645
645
  passengers_estimated: number | null;
646
646
  passengers_observed: number | null;
647
647
  passengers_observed_on_board_sales_amount: number | null;
@@ -771,6 +771,7 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
771
771
  line_id: number;
772
772
  pattern_id: string;
773
773
  trip_id: string;
774
+ seen_last_at: import("@tmlmobilidade/types").UnixTimestamp | null;
774
775
  driver_ids: string[];
775
776
  headsign: string;
776
777
  plan_id: string;
@@ -790,7 +791,6 @@ declare class RidesClass extends MongoCollectionClass<Ride, CreateRideDto, Updat
790
791
  extension_observed: number | null;
791
792
  extension_scheduled: number;
792
793
  seen_first_at: import("@tmlmobilidade/types").UnixTimestamp | null;
793
- seen_last_at: import("@tmlmobilidade/types").UnixTimestamp | null;
794
794
  passengers_estimated: number | null;
795
795
  passengers_observed: number | null;
796
796
  passengers_observed_on_board_sales_amount: number | null;
@@ -1,6 +1,6 @@
1
1
  import { MongoCollectionClass } from '../../common/mongo-collection.js';
2
2
  import { type CreateStopDto, type Stop, type UpdateStopDto } from '@tmlmobilidade/types';
3
- import { type IndexDescription, type Sort } from 'mongodb';
3
+ import { type DeleteResult, type IndexDescription, type Sort } from 'mongodb';
4
4
  import { z } from 'zod';
5
5
  declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, UpdateStopDto> {
6
6
  private static _instance;
@@ -8,13 +8,26 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
8
8
  protected updateSchema: z.ZodSchema;
9
9
  private constructor();
10
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>;
11
25
  /**
12
26
  * Finds stop documents by municipality ID with optional pagination and sorting.
13
- *
14
- * @param id - The municipality ID to search for
15
- * @param perPage - Optional number of documents per page for pagination
16
- * @param page - Optional page number for pagination
17
- * @param sort - Optional sort specification
27
+ * @param id The municipality ID to search for
28
+ * @param perPage Optional number of documents per page for pagination
29
+ * @param page Optional page number for pagination
30
+ * @param sort Optional sort specification
18
31
  * @returns A promise that resolves to an array of matching stop documents
19
32
  */
20
33
  findByMunicipalityId(id: string, perPage?: number, page?: number, sort?: Sort): Promise<import("mongodb").WithId<{
@@ -22,10 +35,12 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
22
35
  created_at: number & {
23
36
  __brand: "UnixTimestamp";
24
37
  };
38
+ is_locked: boolean;
25
39
  updated_at: number & {
26
40
  __brand: "UnixTimestamp";
27
41
  };
28
42
  name: string;
43
+ short_name: string;
29
44
  comments: ({
30
45
  created_at: number & {
31
46
  __brand: "UnixTimestamp";
@@ -66,54 +81,51 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
66
81
  created_by?: string | undefined;
67
82
  updated_by?: string | undefined;
68
83
  })[];
69
- is_locked: boolean;
70
- has_bench: "unknown" | "yes" | "no";
71
- has_network_map: "unknown" | "yes" | "no";
72
- has_schedules: "unknown" | "yes" | "no";
73
- has_shelter: "unknown" | "yes" | "no";
74
- has_stop_sign: "unknown" | "yes" | "no";
84
+ has_bench: "unknown" | "available" | "unavailable";
85
+ has_network_map: "unknown" | "available" | "unavailable";
86
+ has_schedules: "unknown" | "available" | "unavailable";
87
+ has_shelter: "unknown" | "available" | "unavailable";
88
+ has_stop_sign: "unknown" | "available" | "unavailable";
75
89
  municipality_id: string;
76
- is_archived: boolean;
90
+ parish_id: string | null;
91
+ shelter_code: string | null;
92
+ shelter_maintainer: string | null;
93
+ is_deleted: boolean;
77
94
  jurisdiction: "unknown" | "ip" | "municipality" | "other";
78
- lifecycle_status: "active" | "inactive" | "provisional" | "seasonal" | "voided";
95
+ legacy_id: string | null;
96
+ lifecycle_status: "draft" | "active" | "inactive" | "provisional" | "seasonal" | "voided";
97
+ new_name: string | null;
98
+ tts_name: string;
79
99
  district_id: string;
80
100
  latitude: number;
101
+ locality_id: string | null;
81
102
  longitude: number;
82
103
  bench_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
83
104
  electricity_status: "unknown" | "available" | "unavailable";
84
105
  pole_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
85
106
  road_type: "unknown" | "complementary_itinerary" | "highway" | "main_itinerary" | "national_road" | "regional_road" | "secondary_road";
107
+ shelter_frame_size: [number, number] | null;
108
+ shelter_installation_date: import("@tmlmobilidade/types").UnixTimestamp | null;
109
+ shelter_make: string | null;
110
+ shelter_model: string | null;
86
111
  shelter_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
112
+ last_infrastructure_check: import("@tmlmobilidade/types").UnixTimestamp | null;
113
+ last_infrastructure_maintenance: import("@tmlmobilidade/types").UnixTimestamp | null;
114
+ last_schedules_check: import("@tmlmobilidade/types").UnixTimestamp | null;
115
+ last_schedules_maintenance: import("@tmlmobilidade/types").UnixTimestamp | null;
87
116
  connections: ("ferry" | "light_rail" | "subway" | "train" | "boat" | "airport" | "bike_sharing" | "bike_parking" | "car_parking")[];
88
117
  facilities: ("school" | "fire_station" | "health_clinic" | "historic_building" | "hospital" | "police_station" | "shopping" | "transit_office" | "university" | "beach")[];
89
118
  equipment: ("pip" | "mupi" | "mini_pip")[];
90
- has_mupi: "unknown" | "yes" | "no";
119
+ has_mupi: "unknown" | "available" | "unavailable";
91
120
  file_ids: string[];
92
121
  image_ids: string[];
122
+ observations: string | null;
93
123
  created_by?: string | undefined;
94
124
  updated_by?: string | undefined;
95
- short_name?: string | null | undefined;
96
- parish_id?: string | null | undefined;
97
- shelter_code?: string | null | undefined;
98
- shelter_maintainer?: string | null | undefined;
99
- legacy_id?: string | null | undefined;
100
- new_name?: string | null | undefined;
101
- tts_name?: string | null | undefined;
102
- locality_id?: string | null | undefined;
103
- shelter_frame_size?: [number, number] | null | undefined;
104
- shelter_installation_date?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
105
- shelter_make?: string | null | undefined;
106
- shelter_model?: string | null | undefined;
107
- last_infrastructure_check?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
108
- last_infrastructure_maintenance?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
109
- last_schedules_check?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
110
- last_schedules_maintenance?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
111
- observations?: string | null | undefined;
112
125
  }>[]>;
113
126
  /**
114
127
  * Finds multiple stop documents by their IDs.
115
- *
116
- * @param ids - Array of stop IDs to search for
128
+ * @param ids Array of stop IDs to search for
117
129
  * @returns A promise that resolves to an array of matching stop documents
118
130
  */
119
131
  findManyByIds(ids: string[]): Promise<import("mongodb").WithId<{
@@ -121,10 +133,12 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
121
133
  created_at: number & {
122
134
  __brand: "UnixTimestamp";
123
135
  };
136
+ is_locked: boolean;
124
137
  updated_at: number & {
125
138
  __brand: "UnixTimestamp";
126
139
  };
127
140
  name: string;
141
+ short_name: string;
128
142
  comments: ({
129
143
  created_at: number & {
130
144
  __brand: "UnixTimestamp";
@@ -165,50 +179,57 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
165
179
  created_by?: string | undefined;
166
180
  updated_by?: string | undefined;
167
181
  })[];
168
- is_locked: boolean;
169
- has_bench: "unknown" | "yes" | "no";
170
- has_network_map: "unknown" | "yes" | "no";
171
- has_schedules: "unknown" | "yes" | "no";
172
- has_shelter: "unknown" | "yes" | "no";
173
- has_stop_sign: "unknown" | "yes" | "no";
182
+ has_bench: "unknown" | "available" | "unavailable";
183
+ has_network_map: "unknown" | "available" | "unavailable";
184
+ has_schedules: "unknown" | "available" | "unavailable";
185
+ has_shelter: "unknown" | "available" | "unavailable";
186
+ has_stop_sign: "unknown" | "available" | "unavailable";
174
187
  municipality_id: string;
175
- is_archived: boolean;
188
+ parish_id: string | null;
189
+ shelter_code: string | null;
190
+ shelter_maintainer: string | null;
191
+ is_deleted: boolean;
176
192
  jurisdiction: "unknown" | "ip" | "municipality" | "other";
177
- lifecycle_status: "active" | "inactive" | "provisional" | "seasonal" | "voided";
193
+ legacy_id: string | null;
194
+ lifecycle_status: "draft" | "active" | "inactive" | "provisional" | "seasonal" | "voided";
195
+ new_name: string | null;
196
+ tts_name: string;
178
197
  district_id: string;
179
198
  latitude: number;
199
+ locality_id: string | null;
180
200
  longitude: number;
181
201
  bench_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
182
202
  electricity_status: "unknown" | "available" | "unavailable";
183
203
  pole_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
184
204
  road_type: "unknown" | "complementary_itinerary" | "highway" | "main_itinerary" | "national_road" | "regional_road" | "secondary_road";
205
+ shelter_frame_size: [number, number] | null;
206
+ shelter_installation_date: import("@tmlmobilidade/types").UnixTimestamp | null;
207
+ shelter_make: string | null;
208
+ shelter_model: string | null;
185
209
  shelter_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
210
+ last_infrastructure_check: import("@tmlmobilidade/types").UnixTimestamp | null;
211
+ last_infrastructure_maintenance: import("@tmlmobilidade/types").UnixTimestamp | null;
212
+ last_schedules_check: import("@tmlmobilidade/types").UnixTimestamp | null;
213
+ last_schedules_maintenance: import("@tmlmobilidade/types").UnixTimestamp | null;
186
214
  connections: ("ferry" | "light_rail" | "subway" | "train" | "boat" | "airport" | "bike_sharing" | "bike_parking" | "car_parking")[];
187
215
  facilities: ("school" | "fire_station" | "health_clinic" | "historic_building" | "hospital" | "police_station" | "shopping" | "transit_office" | "university" | "beach")[];
188
216
  equipment: ("pip" | "mupi" | "mini_pip")[];
189
- has_mupi: "unknown" | "yes" | "no";
217
+ has_mupi: "unknown" | "available" | "unavailable";
190
218
  file_ids: string[];
191
219
  image_ids: string[];
220
+ observations: string | null;
192
221
  created_by?: string | undefined;
193
222
  updated_by?: string | undefined;
194
- short_name?: string | null | undefined;
195
- parish_id?: string | null | undefined;
196
- shelter_code?: string | null | undefined;
197
- shelter_maintainer?: string | null | undefined;
198
- legacy_id?: string | null | undefined;
199
- new_name?: string | null | undefined;
200
- tts_name?: string | null | undefined;
201
- locality_id?: string | null | undefined;
202
- shelter_frame_size?: [number, number] | null | undefined;
203
- shelter_installation_date?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
204
- shelter_make?: string | null | undefined;
205
- shelter_model?: string | null | undefined;
206
- last_infrastructure_check?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
207
- last_infrastructure_maintenance?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
208
- last_schedules_check?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
209
- last_schedules_maintenance?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
210
- observations?: string | null | undefined;
211
223
  }>[]>;
224
+ /**
225
+ * Toogle the delete status of a document by its ID.
226
+ * Stop documents are never truly deleted to preserve
227
+ * data integrity and prevent ID reuse.
228
+ * @param id The ID of the stop document to delete.
229
+ * @param forceValue Optional boolean to explicitly set the deleted status.
230
+ * @returns A promise that resolves to the result of the delete operation.
231
+ */
232
+ toggleDeleteById(id: string, forceValue?: boolean): Promise<void>;
212
233
  protected getCollectionIndexes(): IndexDescription[];
213
234
  protected getCollectionName(): string;
214
235
  protected getEnvName(): string;
@@ -18,13 +18,30 @@ class StopsClass extends MongoCollectionClass {
18
18
  }
19
19
  return StopsClass._instance;
20
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
+ }
21
39
  /**
22
40
  * Finds stop documents by municipality ID with optional pagination and sorting.
23
- *
24
- * @param id - The municipality ID to search for
25
- * @param perPage - Optional number of documents per page for pagination
26
- * @param page - Optional page number for pagination
27
- * @param sort - Optional sort specification
41
+ * @param id The municipality ID to search for
42
+ * @param perPage Optional number of documents per page for pagination
43
+ * @param page Optional page number for pagination
44
+ * @param sort Optional sort specification
28
45
  * @returns A promise that resolves to an array of matching stop documents
29
46
  */
30
47
  async findByMunicipalityId(id, perPage, page, sort) {
@@ -39,13 +56,30 @@ class StopsClass extends MongoCollectionClass {
39
56
  }
40
57
  /**
41
58
  * Finds multiple stop documents by their IDs.
42
- *
43
- * @param ids - Array of stop IDs to search for
59
+ * @param ids Array of stop IDs to search for
44
60
  * @returns A promise that resolves to an array of matching stop documents
45
61
  */
46
62
  async findManyByIds(ids) {
47
63
  return this.mongoCollection.find({ _id: { $in: ids } }).toArray();
48
64
  }
65
+ /**
66
+ * Toogle the delete status of a document by its ID.
67
+ * Stop documents are never truly deleted to preserve
68
+ * data integrity and prevent ID reuse.
69
+ * @param id The ID of the stop document to delete.
70
+ * @param forceValue Optional boolean to explicitly set the deleted status.
71
+ * @returns A promise that resolves to the result of the delete operation.
72
+ */
73
+ async toggleDeleteById(id, forceValue) {
74
+ // Get the current document from the database
75
+ const foundDoc = await this.findById(id);
76
+ if (!foundDoc)
77
+ throw new Error('Stop not found');
78
+ // Determine the new deleted status
79
+ const newDeletedStatus = forceValue !== undefined ? forceValue : !foundDoc.is_deleted;
80
+ // If the document is deleted, we allow the operation even if it's locked
81
+ await this.updateById(id, { is_deleted: newDeletedStatus }, { forceIfLocked: !newDeletedStatus && foundDoc.is_locked });
82
+ }
49
83
  getCollectionIndexes() {
50
84
  return [
51
85
  { background: true, key: { name: 1 } },
@@ -112,7 +112,7 @@ class AuthProvider {
112
112
  */
113
113
  async login(loginDto) {
114
114
  // Find the user by email
115
- const userData = await users.findByEmail(loginDto.email, true);
115
+ const userData = await users.findByEmail(loginDto.email, { includeUnsafeProperties: true });
116
116
  if (!userData)
117
117
  throw new HttpException(HttpStatus.UNAUTHORIZED, 'User not found');
118
118
  // Check if the password matches the stored hash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/interfaces",
3
- "version": "20251217.1540.37",
3
+ "version": "20251218.110.37",
4
4
  "author": {
5
5
  "email": "iso@tmlmobilidade.pt",
6
6
  "name": "TML-ISO"
@@ -53,7 +53,7 @@
53
53
  "devDependencies": {
54
54
  "@tmlmobilidade/tsconfig": "*",
55
55
  "@tmlmobilidade/types": "*",
56
- "@types/node": "25.0.1",
56
+ "@types/node": "25.0.3",
57
57
  "resolve-tspaths": "0.8.23",
58
58
  "tsc-watch": "7.2.0",
59
59
  "typescript": "5.9.3"