@tmlmobilidade/interfaces 20251022.1644.0-staging.0 → 20251023.1546.16-staging.0

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.
@@ -22,11 +22,11 @@ declare class VerificationTokensClass extends MongoCollectionClass<VerificationT
22
22
  updated_at: number & {
23
23
  __brand: "UnixTimestamp";
24
24
  };
25
- user_id: string;
26
25
  expires_at: number & {
27
26
  __brand: "UnixTimestamp";
28
27
  };
29
28
  token: string;
29
+ user_id: string;
30
30
  created_by?: string | undefined;
31
31
  updated_by?: string | undefined;
32
32
  }> | null>;
@@ -1 +1,16 @@
1
+ import { MongoCollectionClass } from '../../mongo-collection.js';
2
+ import { CreateProposedChangeDto, ProposedChange, UpdateProposedChangeDto } from '@tmlmobilidade/types';
3
+ import { IndexDescription } from 'mongodb';
4
+ import { z } from 'zod';
5
+ declare class ProposedChangesClass extends MongoCollectionClass<ProposedChange<any>, CreateProposedChangeDto<any>, UpdateProposedChangeDto<any>> {
6
+ private static _instances;
7
+ protected createSchema: z.ZodSchema;
8
+ protected updateSchema: z.ZodSchema;
9
+ private constructor();
10
+ static getInstance(typeName?: string): Promise<ProposedChangesClass>;
11
+ protected getCollectionIndexes(): IndexDescription[];
12
+ protected getCollectionName(): string;
13
+ protected getEnvName(): string;
14
+ }
15
+ export declare const proposedChanges: ProposedChangesClass;
1
16
  export {};
@@ -1,62 +1,34 @@
1
1
  // /* * */
2
- export {};
3
- // import { MongoCollectionClass } from '../../mongo-collection.js';
4
- // import { CreateProposedChangeDto, ProposedChange, ProposedChangeSchema, UpdateProposedChangeDto, UpdateProposedChangeSchema } from '@tmlmobilidade/types';
5
- // import { AsyncSingletonProxy } from '@tmlmobilidade/utils';
6
- // // import { Filter, IndexDescription, Sort } from 'mongodb';
7
- // import { z } from 'zod';
8
- // /* * */
9
- // class ProposedChangesClass extends MongoCollectionClass<ProposedChange, CreateProposedChangeDto, UpdateProposedChangeDto> {
10
- // private static _instance: ProposedChangesClass;
11
- // protected override createSchema: z.ZodSchema = ProposedChangeSchema;
12
- // protected override updateSchema: z.ZodSchema = UpdateProposedChangeSchema;
13
- // private constructor() {
14
- // super();
15
- // }
16
- // public static async getInstance() {
17
- // if (!ProposedChangesClass._instance) {
18
- // const instance = new ProposedChangesClass();
19
- // await instance.connect();
20
- // ProposedChangesClass._instance = instance;
21
- // }
22
- // return ProposedChangesClass._instance;
23
- // }
24
- // // /**
25
- // // * Finds stop documents by municipality ID with optional pagination and sorting.
26
- // // *
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
31
- // // * @returns A promise that resolves to an array of matching stop documents
32
- // // */
33
- // // async findByMunicipalityId(id: string, perPage?: number, page?: number, sort?: Sort) {
34
- // // const query = this.mongoCollection.find({ municipality_id: id } as Filter<Stop>);
35
- // // if (perPage) query.limit(perPage);
36
- // // if (page && perPage) query.skip(perPage * (page - 1));
37
- // // if (sort) query.sort(sort);
38
- // // return query.toArray();
39
- // // }
40
- // // /**
41
- // // * Finds multiple stop documents by their IDs.
42
- // // *
43
- // // * @param ids - Array of stop IDs to search for
44
- // // * @returns A promise that resolves to an array of matching stop documents
45
- // // */
46
- // // async findManyByIds(ids: string[]) {
47
- // // return this.mongoCollection.find({ _id: { $in: ids } } as Filter<Stop>).toArray();
48
- // // }
49
- // // protected getCollectionIndexes(): IndexDescription[] {
50
- // // return [
51
- // // { background: true, key: { name: 1 } },
52
- // // ];
53
- // // }
54
- // // protected getCollectionName(): string {
55
- // // return 'stops';
56
- // // }
57
- // // protected getEnvName(): string {
58
- // // return 'TML_INTERFACE_STOPS';
59
- // // }
60
- // }
61
- // /* * */
62
- // export const proposedChanges = AsyncSingletonProxy(ProposedChangesClass);
2
+ import { MongoCollectionClass } from '../../mongo-collection.js';
3
+ import { ProposedChangeSchema, UpdateProposedChangeSchema } from '@tmlmobilidade/types';
4
+ import { AsyncSingletonProxy } from '@tmlmobilidade/utils';
5
+ /* * */
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
+ class ProposedChangesClass extends MongoCollectionClass {
8
+ static _instances = new Map();
9
+ createSchema = ProposedChangeSchema;
10
+ updateSchema = UpdateProposedChangeSchema;
11
+ constructor() {
12
+ super();
13
+ }
14
+ static async getInstance(typeName) {
15
+ const key = typeName ?? 'default';
16
+ if (!this._instances.has(key)) {
17
+ const instance = new ProposedChangesClass();
18
+ await instance.connect();
19
+ this._instances.set(key, instance);
20
+ }
21
+ return this._instances.get(key);
22
+ }
23
+ getCollectionIndexes() {
24
+ return [{ background: true, key: { name: 1 } }];
25
+ }
26
+ getCollectionName() {
27
+ return 'proposed_changes';
28
+ }
29
+ getEnvName() {
30
+ return 'DATABASE_URI';
31
+ }
32
+ }
33
+ /* * */
34
+ export const proposedChanges = AsyncSingletonProxy(ProposedChangesClass);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/interfaces",
3
- "version": "20251022.1644.0-staging.0",
3
+ "version": "20251023.1546.16-staging.0",
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",