@tmlmobilidade/interfaces 20250909.1538.52 → 20250911.1325.18

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.
@@ -17,14 +17,194 @@ declare class StopsClass extends MongoCollectionClass<Stop, CreateStopDto, Updat
17
17
  * @param sort - Optional sort specification
18
18
  * @returns A promise that resolves to an array of matching stop documents
19
19
  */
20
- findByMunicipalityId(id: string, perPage?: number, page?: number, sort?: Sort): Promise<import("mongodb").WithId<Stop>[]>;
20
+ findByMunicipalityId(id: string, perPage?: number, page?: number, sort?: Sort): Promise<import("mongodb").WithId<{
21
+ _id: string;
22
+ created_at: number & {
23
+ __brand: "UnixTimestamp";
24
+ };
25
+ created_by: string;
26
+ updated_at: number & {
27
+ __brand: "UnixTimestamp";
28
+ };
29
+ updated_by: string;
30
+ name: string;
31
+ has_bench: "unknown" | "yes" | "no";
32
+ has_network_map: "unknown" | "yes" | "no";
33
+ has_schedules: "unknown" | "yes" | "no";
34
+ has_shelter: "unknown" | "yes" | "no";
35
+ has_stop_sign: "unknown" | "yes" | "no";
36
+ municipality_id: string;
37
+ is_locked: boolean;
38
+ comments: ({
39
+ _id: string;
40
+ created_at: number & {
41
+ __brand: "UnixTimestamp";
42
+ };
43
+ created_by: string;
44
+ updated_at: number & {
45
+ __brand: "UnixTimestamp";
46
+ };
47
+ updated_by: string;
48
+ message: string;
49
+ type: "note";
50
+ } | {
51
+ _id: string;
52
+ created_at: number & {
53
+ __brand: "UnixTimestamp";
54
+ };
55
+ created_by: "system";
56
+ updated_at: number & {
57
+ __brand: "UnixTimestamp";
58
+ };
59
+ updated_by: "system";
60
+ message: string;
61
+ type: "system_info";
62
+ } | {
63
+ _id: string;
64
+ created_at: number & {
65
+ __brand: "UnixTimestamp";
66
+ };
67
+ created_by: string;
68
+ updated_at: number & {
69
+ __brand: "UnixTimestamp";
70
+ };
71
+ updated_by: string;
72
+ type: "statusChanged";
73
+ curr_status: string;
74
+ prev_status: string;
75
+ })[];
76
+ is_archived: boolean;
77
+ jurisdiction: "unknown" | "ip" | "municipality" | "other";
78
+ operational_status: "active" | "inactive" | "provisional" | "seasonal" | "voided";
79
+ district_id: string;
80
+ latitude: number;
81
+ longitude: number;
82
+ bench_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
83
+ electricity_status: "unknown" | "available" | "unavailable";
84
+ pole_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
85
+ road_type: "unknown" | "complementary_itinerary" | "highway" | "main_itinerary" | "national_road" | "regional_road" | "secondary_road";
86
+ shelter_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
87
+ connections: ("ferry" | "light_rail" | "subway" | "train" | "boat" | "airport" | "bike_sharing" | "bike_parking" | "car_parking")[];
88
+ facilities: ("school" | "fire_station" | "health_clinic" | "historic_building" | "hospital" | "police_station" | "shopping" | "transit_office" | "university" | "beach")[];
89
+ equipment: ("pip" | "mupi" | "mini_pip")[];
90
+ has_mupi: "unknown" | "yes" | "no";
91
+ file_ids: string[];
92
+ image_ids: string[];
93
+ short_name?: string | null | undefined;
94
+ parish_id?: string | null | undefined;
95
+ shelter_code?: string | null | undefined;
96
+ shelter_maintainer?: string | null | undefined;
97
+ legacy_id?: string | null | undefined;
98
+ new_name?: string | null | undefined;
99
+ tts_name?: string | null | undefined;
100
+ locality_id?: string | null | undefined;
101
+ shelter_frame_size?: [number, number] | null | undefined;
102
+ shelter_installation_date?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
103
+ shelter_make?: string | null | undefined;
104
+ shelter_model?: string | null | undefined;
105
+ last_infrastructure_check?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
106
+ last_infrastructure_maintenance?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
107
+ last_schedules_check?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
108
+ last_schedules_maintenance?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
109
+ observations?: string | null | undefined;
110
+ }>[]>;
21
111
  /**
22
112
  * Finds multiple stop documents by their IDs.
23
113
  *
24
114
  * @param ids - Array of stop IDs to search for
25
115
  * @returns A promise that resolves to an array of matching stop documents
26
116
  */
27
- findManyByIds(ids: string[]): Promise<import("mongodb").WithId<Stop>[]>;
117
+ findManyByIds(ids: string[]): Promise<import("mongodb").WithId<{
118
+ _id: string;
119
+ created_at: number & {
120
+ __brand: "UnixTimestamp";
121
+ };
122
+ created_by: string;
123
+ updated_at: number & {
124
+ __brand: "UnixTimestamp";
125
+ };
126
+ updated_by: string;
127
+ name: string;
128
+ has_bench: "unknown" | "yes" | "no";
129
+ has_network_map: "unknown" | "yes" | "no";
130
+ has_schedules: "unknown" | "yes" | "no";
131
+ has_shelter: "unknown" | "yes" | "no";
132
+ has_stop_sign: "unknown" | "yes" | "no";
133
+ municipality_id: string;
134
+ is_locked: boolean;
135
+ comments: ({
136
+ _id: string;
137
+ created_at: number & {
138
+ __brand: "UnixTimestamp";
139
+ };
140
+ created_by: string;
141
+ updated_at: number & {
142
+ __brand: "UnixTimestamp";
143
+ };
144
+ updated_by: string;
145
+ message: string;
146
+ type: "note";
147
+ } | {
148
+ _id: string;
149
+ created_at: number & {
150
+ __brand: "UnixTimestamp";
151
+ };
152
+ created_by: "system";
153
+ updated_at: number & {
154
+ __brand: "UnixTimestamp";
155
+ };
156
+ updated_by: "system";
157
+ message: string;
158
+ type: "system_info";
159
+ } | {
160
+ _id: string;
161
+ created_at: number & {
162
+ __brand: "UnixTimestamp";
163
+ };
164
+ created_by: string;
165
+ updated_at: number & {
166
+ __brand: "UnixTimestamp";
167
+ };
168
+ updated_by: string;
169
+ type: "statusChanged";
170
+ curr_status: string;
171
+ prev_status: string;
172
+ })[];
173
+ is_archived: boolean;
174
+ jurisdiction: "unknown" | "ip" | "municipality" | "other";
175
+ operational_status: "active" | "inactive" | "provisional" | "seasonal" | "voided";
176
+ district_id: string;
177
+ latitude: number;
178
+ longitude: number;
179
+ bench_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
180
+ electricity_status: "unknown" | "available" | "unavailable";
181
+ pole_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
182
+ road_type: "unknown" | "complementary_itinerary" | "highway" | "main_itinerary" | "national_road" | "regional_road" | "secondary_road";
183
+ shelter_status: "unknown" | "not_applicable" | "missing" | "damaged" | "ok";
184
+ connections: ("ferry" | "light_rail" | "subway" | "train" | "boat" | "airport" | "bike_sharing" | "bike_parking" | "car_parking")[];
185
+ facilities: ("school" | "fire_station" | "health_clinic" | "historic_building" | "hospital" | "police_station" | "shopping" | "transit_office" | "university" | "beach")[];
186
+ equipment: ("pip" | "mupi" | "mini_pip")[];
187
+ has_mupi: "unknown" | "yes" | "no";
188
+ file_ids: string[];
189
+ image_ids: string[];
190
+ short_name?: string | null | undefined;
191
+ parish_id?: string | null | undefined;
192
+ shelter_code?: string | null | undefined;
193
+ shelter_maintainer?: string | null | undefined;
194
+ legacy_id?: string | null | undefined;
195
+ new_name?: string | null | undefined;
196
+ tts_name?: string | null | undefined;
197
+ locality_id?: string | null | undefined;
198
+ shelter_frame_size?: [number, number] | null | undefined;
199
+ shelter_installation_date?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
200
+ shelter_make?: string | null | undefined;
201
+ shelter_model?: string | null | undefined;
202
+ last_infrastructure_check?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
203
+ last_infrastructure_maintenance?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
204
+ last_schedules_check?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
205
+ last_schedules_maintenance?: import("@tmlmobilidade/types").UnixTimestamp | null | undefined;
206
+ observations?: string | null | undefined;
207
+ }>[]>;
28
208
  protected getCollectionIndexes(): IndexDescription[];
29
209
  protected getCollectionName(): string;
30
210
  protected getEnvName(): string;
@@ -104,8 +104,10 @@ class AuthProvider {
104
104
  const session = {
105
105
  _id: generateRandomString(),
106
106
  created_at: Dates.now('utc').unix_timestamp,
107
+ created_by: 'system',
107
108
  token: generateRandomToken(),
108
109
  updated_at: Dates.now('utc').unix_timestamp,
110
+ updated_by: 'system',
109
111
  user_id: userData._id.toString(),
110
112
  };
111
113
  await sessions.insertOne(session);
@@ -136,8 +138,10 @@ class AuthProvider {
136
138
  // Generate a random token that will be used to verify the user
137
139
  const verificationToken = generateRandomToken();
138
140
  await verificationTokens.insertOne({
141
+ created_by: 'system',
139
142
  expires_at: Dates.now('utc').plus({ days: 7 }).unix_timestamp,
140
143
  token: verificationToken,
144
+ updated_by: 'system',
141
145
  user_id: insertNewUserResult._id,
142
146
  });
143
147
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/interfaces",
3
- "version": "20250909.1538.52",
3
+ "version": "20250911.1325.18",
4
4
  "author": "João de Vasconcelos & Jusi Monteiro",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "homepage": "https://github.com/tmlmobilidade/services#readme",
@@ -1,63 +0,0 @@
1
- import { MongoCollectionClass } from '../../mongo-collection.js';
2
- import { CreateRideAnnotationDto, RideAnnotation, UpdateRideAnnotationDto } from '@tmlmobilidade/types';
3
- import { IndexDescription } from 'mongodb';
4
- import { z } from 'zod';
5
- declare class RideAnnotationsClass extends MongoCollectionClass<RideAnnotation, CreateRideAnnotationDto, UpdateRideAnnotationDto> {
6
- private static _instance;
7
- protected createSchema: z.ZodSchema;
8
- protected updateSchema: z.ZodSchema;
9
- private constructor();
10
- static getInstance(): Promise<RideAnnotationsClass>;
11
- /**
12
- * Finds ride documents by Ride ID.
13
- * @param rideId - The Ride ID to search for.
14
- * @returns A promise that resolves to an array of matching ride documents.
15
- */
16
- findByRideId(rideId: string): Promise<import("mongodb").WithId<{
17
- _id: string;
18
- is_locked: boolean;
19
- acceptance: {
20
- _id: string;
21
- status: "accepted" | "justification_required" | "under_review" | "rejected";
22
- created_by: string | null;
23
- analysis_summary: Record<string, "error" | "pass" | "fail" | "skip"> | null;
24
- mode: "manual" | "auto";
25
- created_at?: (number & {
26
- __brand: "UnixTimestamp";
27
- } & z.BRAND<"UnixTimestamp">) | null | undefined;
28
- updated_at?: (number & {
29
- __brand: "UnixTimestamp";
30
- } & z.BRAND<"UnixTimestamp">) | null | undefined;
31
- }[];
32
- justification: {
33
- comments: {
34
- _id: string;
35
- text: string;
36
- user_id: string;
37
- created_at?: (number & {
38
- __brand: "UnixTimestamp";
39
- } & z.BRAND<"UnixTimestamp">) | null | undefined;
40
- updated_at?: (number & {
41
- __brand: "UnixTimestamp";
42
- } & z.BRAND<"UnixTimestamp">) | null | undefined;
43
- }[];
44
- file_ids: string[];
45
- pto_message: string;
46
- } | null;
47
- overrides: {
48
- trip_id: string | null;
49
- } | null;
50
- ride_id: string;
51
- created_at?: (number & {
52
- __brand: "UnixTimestamp";
53
- } & z.BRAND<"UnixTimestamp">) | null | undefined;
54
- updated_at?: (number & {
55
- __brand: "UnixTimestamp";
56
- } & z.BRAND<"UnixTimestamp">) | null | undefined;
57
- }>[]>;
58
- protected getCollectionIndexes(): IndexDescription[];
59
- protected getCollectionName(): string;
60
- protected getEnvName(): string;
61
- }
62
- export declare const rideAnnotations: RideAnnotationsClass;
63
- export {};
@@ -1,48 +0,0 @@
1
- /* * */
2
- import { MongoCollectionClass } from '../../mongo-collection.js';
3
- import { RideAnnotationSchema, UpdateRideAnnotationSchema } from '@tmlmobilidade/types';
4
- import { AsyncSingletonProxy } from '@tmlmobilidade/utils';
5
- /* * */
6
- class RideAnnotationsClass extends MongoCollectionClass {
7
- static _instance;
8
- createSchema = RideAnnotationSchema;
9
- updateSchema = UpdateRideAnnotationSchema;
10
- constructor() {
11
- super();
12
- }
13
- static async getInstance() {
14
- if (!RideAnnotationsClass._instance) {
15
- const instance = new RideAnnotationsClass();
16
- await instance.connect();
17
- RideAnnotationsClass._instance = instance;
18
- }
19
- return RideAnnotationsClass._instance;
20
- }
21
- /**
22
- * Finds ride documents by Ride ID.
23
- * @param rideId - The Ride ID to search for.
24
- * @returns A promise that resolves to an array of matching ride documents.
25
- */
26
- async findByRideId(rideId) {
27
- return this.mongoCollection.find({ ride_id: rideId }).toArray();
28
- }
29
- getCollectionIndexes() {
30
- /**
31
- * IMPORTANT:
32
- * Automatic sorting (ESLint) of keys in the JS objects should be disabled.
33
- * The order of keys in a compound index is very important and should be
34
- * carefully considered based on the cardinality of each key.
35
- */
36
- return [
37
- { background: true, key: { ride_id: 1 } },
38
- ];
39
- }
40
- getCollectionName() {
41
- return 'ride_annotations';
42
- }
43
- getEnvName() {
44
- return 'DATABASE_URI';
45
- }
46
- }
47
- /* * */
48
- export const rideAnnotations = AsyncSingletonProxy(RideAnnotationsClass);