@tmlmobilidade/interfaces 20260723.1414.56 → 20260723.1550.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.
- package/dist/interfaces/index.d.ts +0 -1
- package/dist/interfaces/index.js +0 -1
- package/package.json +1 -1
- package/dist/interfaces/locations/districts.d.ts +0 -13
- package/dist/interfaces/locations/districts.js +0 -29
- package/dist/interfaces/locations/index.d.ts +0 -5
- package/dist/interfaces/locations/index.js +0 -5
- package/dist/interfaces/locations/localities.d.ts +0 -13
- package/dist/interfaces/locations/localities.js +0 -29
- package/dist/interfaces/locations/locations.d.ts +0 -43
- package/dist/interfaces/locations/locations.js +0 -211
- package/dist/interfaces/locations/municipalities.d.ts +0 -13
- package/dist/interfaces/locations/municipalities.js +0 -29
- package/dist/interfaces/locations/parishes.d.ts +0 -13
- package/dist/interfaces/locations/parishes.js +0 -29
package/dist/interfaces/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
2
|
-
import { type District } from '@tmlmobilidade/types';
|
|
3
|
-
import { type IndexDescription } from 'mongodb';
|
|
4
|
-
declare class DistrictsClass extends MongoCollectionClass<District, District, District> {
|
|
5
|
-
private static _instance;
|
|
6
|
-
private constructor();
|
|
7
|
-
static getInstance(): Promise<DistrictsClass>;
|
|
8
|
-
protected getCollectionIndexes(): IndexDescription[];
|
|
9
|
-
protected getCollectionName(): string;
|
|
10
|
-
protected getEnvName(): string;
|
|
11
|
-
}
|
|
12
|
-
export declare const districts: DistrictsClass;
|
|
13
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/* * */
|
|
2
|
-
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
3
|
-
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
4
|
-
/* * */
|
|
5
|
-
class DistrictsClass extends MongoCollectionClass {
|
|
6
|
-
static _instance;
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
}
|
|
10
|
-
static async getInstance() {
|
|
11
|
-
if (!DistrictsClass._instance) {
|
|
12
|
-
const instance = new DistrictsClass();
|
|
13
|
-
await instance.connect();
|
|
14
|
-
DistrictsClass._instance = instance;
|
|
15
|
-
}
|
|
16
|
-
return DistrictsClass._instance;
|
|
17
|
-
}
|
|
18
|
-
getCollectionIndexes() {
|
|
19
|
-
return [];
|
|
20
|
-
}
|
|
21
|
-
getCollectionName() {
|
|
22
|
-
return 'districts';
|
|
23
|
-
}
|
|
24
|
-
getEnvName() {
|
|
25
|
-
return 'DATABASE_URI';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/* * */
|
|
29
|
-
export const districts = asyncSingletonProxy(DistrictsClass);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
2
|
-
import { type Locality } from '@tmlmobilidade/types';
|
|
3
|
-
import { type IndexDescription } from 'mongodb';
|
|
4
|
-
declare class LocalitiesClass extends MongoCollectionClass<Locality, Locality, Locality> {
|
|
5
|
-
private static _instance;
|
|
6
|
-
private constructor();
|
|
7
|
-
static getInstance(): Promise<LocalitiesClass>;
|
|
8
|
-
protected getCollectionIndexes(): IndexDescription[];
|
|
9
|
-
protected getCollectionName(): string;
|
|
10
|
-
protected getEnvName(): string;
|
|
11
|
-
}
|
|
12
|
-
export declare const localities: LocalitiesClass;
|
|
13
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/* * */
|
|
2
|
-
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
3
|
-
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
4
|
-
/* * */
|
|
5
|
-
class LocalitiesClass extends MongoCollectionClass {
|
|
6
|
-
static _instance;
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
}
|
|
10
|
-
static async getInstance() {
|
|
11
|
-
if (!LocalitiesClass._instance) {
|
|
12
|
-
const instance = new LocalitiesClass();
|
|
13
|
-
await instance.connect();
|
|
14
|
-
LocalitiesClass._instance = instance;
|
|
15
|
-
}
|
|
16
|
-
return LocalitiesClass._instance;
|
|
17
|
-
}
|
|
18
|
-
getCollectionIndexes() {
|
|
19
|
-
return [];
|
|
20
|
-
}
|
|
21
|
-
getCollectionName() {
|
|
22
|
-
return 'localities';
|
|
23
|
-
}
|
|
24
|
-
getEnvName() {
|
|
25
|
-
return 'DATABASE_URI';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/* * */
|
|
29
|
-
export const localities = asyncSingletonProxy(LocalitiesClass);
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { type CensusFeature, type District, type Locality, type Location, type Municipality, type Parish } from '@tmlmobilidade/types';
|
|
2
|
-
import { Filter, FindOptions, WithId } from 'mongodb';
|
|
3
|
-
declare class LocationsClass {
|
|
4
|
-
private static _instance;
|
|
5
|
-
private collections;
|
|
6
|
-
private mongoConnector;
|
|
7
|
-
private constructor();
|
|
8
|
-
static getInstance(): Promise<LocationsClass>;
|
|
9
|
-
countCensus: (filter?: Filter<CensusFeature>) => Promise<number>;
|
|
10
|
-
countDistricts: (filter?: Filter<District>) => Promise<number>;
|
|
11
|
-
countLocalities: (filter?: Filter<Locality>) => Promise<number>;
|
|
12
|
-
countMunicipalities: (filter?: Filter<Municipality>) => Promise<number>;
|
|
13
|
-
countParishes: (filter?: Filter<Parish>) => Promise<number>;
|
|
14
|
-
findCensus: (filter?: Filter<CensusFeature>, options?: FindOptions) => Promise<WithId<CensusFeature>[]>;
|
|
15
|
-
findDistricts: (filter?: Filter<District>, options?: FindOptions) => Promise<District[]>;
|
|
16
|
-
findLocalities: (filter?: Filter<Locality>, options?: FindOptions) => Promise<Locality[]>;
|
|
17
|
-
findMunicipalities: (filter?: Filter<Municipality>, options?: FindOptions) => Promise<Municipality[]>;
|
|
18
|
-
findParishes: (filter?: Filter<Parish>, options?: FindOptions) => Promise<Parish[]>;
|
|
19
|
-
findCensusById: (id: string, options?: FindOptions) => Promise<null | WithId<CensusFeature>>;
|
|
20
|
-
findDistrictById: (id: string, options?: FindOptions) => Promise<District | null>;
|
|
21
|
-
findLocalityById: (id: string, options?: FindOptions) => Promise<Locality | null>;
|
|
22
|
-
findMunicipalityById: (id: string, options?: FindOptions) => Promise<Municipality | null>;
|
|
23
|
-
findParishById: (id: string, options?: FindOptions) => Promise<null | Parish>;
|
|
24
|
-
findMunicipalitiesByGeo: (lat: number, lon: number, options?: FindOptions) => Promise<Municipality | null>;
|
|
25
|
-
findParishesByGeo: (lat: number, lon: number, options?: FindOptions) => Promise<null | Parish>;
|
|
26
|
-
findDistrictsByGeo: (lat: number, lon: number, options?: FindOptions) => Promise<District | null>;
|
|
27
|
-
findLocalitiesByGeo: (lat: number, lon: number, options?: FindOptions) => Promise<Locality | null>;
|
|
28
|
-
findCensusByGeo: (lat: number, lon: number, options?: FindOptions) => Promise<null | WithId<CensusFeature>>;
|
|
29
|
-
findLocationByGeo(lat: number, lon: number, { census }?: {
|
|
30
|
-
census?: boolean;
|
|
31
|
-
}): Promise<Location>;
|
|
32
|
-
private connect;
|
|
33
|
-
private findById;
|
|
34
|
-
private findMany;
|
|
35
|
-
private findOne;
|
|
36
|
-
private count;
|
|
37
|
-
private geoFilter;
|
|
38
|
-
private transformDocument;
|
|
39
|
-
private convertFilterField;
|
|
40
|
-
private convertFilter;
|
|
41
|
-
}
|
|
42
|
-
export declare const locations: LocationsClass;
|
|
43
|
-
export {};
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/* eslint-disable perfectionist/sort-classes */
|
|
3
|
-
import { HTTP_STATUS, HttpException } from '@tmlmobilidade/consts';
|
|
4
|
-
import { MongoConnector } from '@tmlmobilidade/mongo';
|
|
5
|
-
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
6
|
-
/* * */
|
|
7
|
-
class LocationsClass {
|
|
8
|
-
static _instance;
|
|
9
|
-
collections;
|
|
10
|
-
mongoConnector;
|
|
11
|
-
constructor() {
|
|
12
|
-
this.collections = {};
|
|
13
|
-
}
|
|
14
|
-
static async getInstance() {
|
|
15
|
-
if (!this._instance) {
|
|
16
|
-
const instance = new LocationsClass();
|
|
17
|
-
await instance.connect();
|
|
18
|
-
this._instance = instance;
|
|
19
|
-
}
|
|
20
|
-
return this._instance;
|
|
21
|
-
}
|
|
22
|
-
/* Public Methods */
|
|
23
|
-
/* Count */
|
|
24
|
-
countCensus = async (filter) => await this.count(this.collections.census, filter);
|
|
25
|
-
countDistricts = async (filter) => {
|
|
26
|
-
const _filter = this.convertFilter(filter);
|
|
27
|
-
return await this.count(this.collections.districts, _filter);
|
|
28
|
-
};
|
|
29
|
-
countLocalities = async (filter) => {
|
|
30
|
-
const _filter = this.convertFilter(filter);
|
|
31
|
-
return await this.count(this.collections.localities, _filter);
|
|
32
|
-
};
|
|
33
|
-
countMunicipalities = async (filter) => {
|
|
34
|
-
const _filter = this.convertFilter(filter);
|
|
35
|
-
return await this.count(this.collections.municipalities, _filter);
|
|
36
|
-
};
|
|
37
|
-
countParishes = async (filter) => {
|
|
38
|
-
const _filter = this.convertFilter(filter);
|
|
39
|
-
return await this.count(this.collections.parishes, _filter);
|
|
40
|
-
};
|
|
41
|
-
/* Find All */
|
|
42
|
-
findCensus = async (filter, options) => await this.findMany(this.collections.census, filter, options);
|
|
43
|
-
findDistricts = async (filter, options) => {
|
|
44
|
-
const _filter = this.convertFilter(filter);
|
|
45
|
-
const documents = await this.findMany(this.collections.districts, _filter, options);
|
|
46
|
-
return documents.map(doc => this.transformDocument(doc));
|
|
47
|
-
};
|
|
48
|
-
findLocalities = async (filter, options) => {
|
|
49
|
-
const _filter = this.convertFilter(filter);
|
|
50
|
-
const documents = await this.findMany(this.collections.localities, _filter, options);
|
|
51
|
-
return documents.map(doc => this.transformDocument(doc));
|
|
52
|
-
};
|
|
53
|
-
findMunicipalities = async (filter, options) => {
|
|
54
|
-
const _filter = this.convertFilter(filter);
|
|
55
|
-
const documents = await this.findMany(this.collections.municipalities, _filter, options);
|
|
56
|
-
return documents.map(doc => this.transformDocument(doc));
|
|
57
|
-
};
|
|
58
|
-
findParishes = async (filter, options) => {
|
|
59
|
-
const _filter = this.convertFilter(filter);
|
|
60
|
-
const documents = await this.findMany(this.collections.parishes, _filter, options);
|
|
61
|
-
return documents.map(doc => this.transformDocument(doc));
|
|
62
|
-
};
|
|
63
|
-
/* Find By Id */
|
|
64
|
-
findCensusById = async (id, options) => await this.findById(this.collections.census, id, options);
|
|
65
|
-
findDistrictById = async (id, options) => {
|
|
66
|
-
const document = await this.findById(this.collections.districts, id, options);
|
|
67
|
-
return document ? this.transformDocument(document) : null;
|
|
68
|
-
};
|
|
69
|
-
findLocalityById = async (id, options) => {
|
|
70
|
-
const document = await this.findById(this.collections.localities, id, options);
|
|
71
|
-
return document ? this.transformDocument(document) : null;
|
|
72
|
-
};
|
|
73
|
-
findMunicipalityById = async (id, options) => {
|
|
74
|
-
const document = await this.findById(this.collections.municipalities, id, options);
|
|
75
|
-
return document ? this.transformDocument(document) : null;
|
|
76
|
-
};
|
|
77
|
-
findParishById = async (id, options) => {
|
|
78
|
-
const document = await this.findById(this.collections.parishes, id, options);
|
|
79
|
-
return document ? this.transformDocument(document) : null;
|
|
80
|
-
};
|
|
81
|
-
/* Find By Geo */
|
|
82
|
-
findMunicipalitiesByGeo = async (lat, lon, options) => {
|
|
83
|
-
const document = await this.findOne(this.collections.municipalities, this.geoFilter(lat, lon), options);
|
|
84
|
-
return document ? this.transformDocument(document) : null;
|
|
85
|
-
};
|
|
86
|
-
findParishesByGeo = async (lat, lon, options) => {
|
|
87
|
-
const document = await this.findOne(this.collections.parishes, this.geoFilter(lat, lon), options);
|
|
88
|
-
return document ? this.transformDocument(document) : null;
|
|
89
|
-
};
|
|
90
|
-
findDistrictsByGeo = async (lat, lon, options) => {
|
|
91
|
-
const document = await this.findOne(this.collections.districts, this.geoFilter(lat, lon), options);
|
|
92
|
-
return document ? this.transformDocument(document) : null;
|
|
93
|
-
};
|
|
94
|
-
findLocalitiesByGeo = async (lat, lon, options) => {
|
|
95
|
-
const document = await this.findOne(this.collections.localities, this.geoFilter(lat, lon), options);
|
|
96
|
-
return document ? this.transformDocument(document) : null;
|
|
97
|
-
};
|
|
98
|
-
findCensusByGeo = async (lat, lon, options) => await this.findOne(this.collections.census, this.geoFilter(lat, lon), options);
|
|
99
|
-
async findLocationByGeo(lat, lon, { census = false } = {}) {
|
|
100
|
-
if (!lat || !lon)
|
|
101
|
-
throw new HttpException(HTTP_STATUS.BAD_REQUEST, 'Missing latitude or longitude');
|
|
102
|
-
const municipality = await this.findMunicipalitiesByGeo(lat, lon, { projection: { _id: 1, properties: 1 } });
|
|
103
|
-
const parish = await this.findParishesByGeo(lat, lon, { projection: { _id: 1, properties: 1 } });
|
|
104
|
-
const district = await this.findDistrictsByGeo(lat, lon, { projection: { _id: 1, properties: 1 } });
|
|
105
|
-
const locality = await this.findLocalitiesByGeo(lat, lon, { projection: { _id: 1, properties: 1 } });
|
|
106
|
-
const _census = census ? await this.findCensusByGeo(lat, lon, { projection: { _id: 1, properties: 1 } }) : undefined;
|
|
107
|
-
return {
|
|
108
|
-
census: { ..._census?.properties, _id: _census?._id },
|
|
109
|
-
district: district,
|
|
110
|
-
latitude: lat,
|
|
111
|
-
locality: locality,
|
|
112
|
-
longitude: lon,
|
|
113
|
-
municipality: municipality,
|
|
114
|
-
parish: parish,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
;
|
|
118
|
-
/* Private Methods - Database Connection */
|
|
119
|
-
async connect() {
|
|
120
|
-
const dbUri = process.env.DATABASE_URI;
|
|
121
|
-
if (!dbUri)
|
|
122
|
-
throw new Error(`Missing DATABASE_URI environment variable`);
|
|
123
|
-
try {
|
|
124
|
-
this.mongoConnector = new MongoConnector(dbUri);
|
|
125
|
-
await this.mongoConnector.connect();
|
|
126
|
-
const db = this.mongoConnector.client.db('production');
|
|
127
|
-
this.collections = {
|
|
128
|
-
census: db.collection('census'),
|
|
129
|
-
districts: db.collection('districts'),
|
|
130
|
-
localities: db.collection('localities'),
|
|
131
|
-
municipalities: db.collection('municipalities'),
|
|
132
|
-
parishes: db.collection('parishes'),
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
catch (error) {
|
|
136
|
-
throw new Error(`Error connecting to MongoDB`, { cause: error });
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
/* Private Methods - Database Operations */
|
|
140
|
-
async findById(collection, id, options) {
|
|
141
|
-
return collection.findOne({ _id: { $eq: id } }, options);
|
|
142
|
-
}
|
|
143
|
-
async findMany(collection, filter = {}, options) {
|
|
144
|
-
const query = collection.find(filter, options);
|
|
145
|
-
return query.toArray();
|
|
146
|
-
}
|
|
147
|
-
async findOne(collection, filter, options) {
|
|
148
|
-
return collection.findOne(filter, options);
|
|
149
|
-
}
|
|
150
|
-
async count(collection, filter = {}) {
|
|
151
|
-
return collection.countDocuments(filter);
|
|
152
|
-
}
|
|
153
|
-
geoFilter = (lat, lon) => ({ geometry: { $geoIntersects: { $geometry: { coordinates: [lon, lat], type: 'Point' } } } });
|
|
154
|
-
transformDocument(doc) {
|
|
155
|
-
const geojson = doc.geometry ? {
|
|
156
|
-
geometry: doc.geometry,
|
|
157
|
-
properties: {},
|
|
158
|
-
type: doc.type,
|
|
159
|
-
} : undefined;
|
|
160
|
-
return {
|
|
161
|
-
_id: doc._id,
|
|
162
|
-
...doc?.properties,
|
|
163
|
-
geojson,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
convertFilterField = (key) => {
|
|
167
|
-
if (key.startsWith('geojson.geometry'))
|
|
168
|
-
return key.replace('geojson.geometry', 'geometry');
|
|
169
|
-
if (key.startsWith('geojson.type'))
|
|
170
|
-
return key.replace('geojson.type', 'type');
|
|
171
|
-
if (key.startsWith('geojson'))
|
|
172
|
-
return key.replace('geojson', ''); // fallback
|
|
173
|
-
if (!key.startsWith('_id'))
|
|
174
|
-
return `properties.${key}`;
|
|
175
|
-
return key;
|
|
176
|
-
};
|
|
177
|
-
convertFilter = (filter) => {
|
|
178
|
-
if (!filter || typeof filter !== 'object')
|
|
179
|
-
return filter;
|
|
180
|
-
if (Array.isArray(filter)) {
|
|
181
|
-
return filter.map(this.convertFilter);
|
|
182
|
-
}
|
|
183
|
-
const output = {};
|
|
184
|
-
for (const [key, value] of Object.entries(filter)) {
|
|
185
|
-
if (key.startsWith('$')) {
|
|
186
|
-
// Recursive operator like $and, $or, $nor
|
|
187
|
-
if (Array.isArray(value)) {
|
|
188
|
-
output[key] = value.map(this.convertFilter);
|
|
189
|
-
}
|
|
190
|
-
else if (typeof value === 'object') {
|
|
191
|
-
output[key] = this.convertFilter(value);
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
output[key] = value;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
const newKey = this.convertFilterField(key);
|
|
199
|
-
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
200
|
-
output[newKey] = this.convertFilter(value); // nested operator (e.g., $gt)
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
output[newKey] = value;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return output;
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
/* * */
|
|
211
|
-
export const locations = asyncSingletonProxy(LocationsClass);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
2
|
-
import { type Municipality } from '@tmlmobilidade/types';
|
|
3
|
-
import { type IndexDescription } from 'mongodb';
|
|
4
|
-
declare class MunicipalitiesClass extends MongoCollectionClass<Municipality, Municipality, Municipality> {
|
|
5
|
-
private static _instance;
|
|
6
|
-
private constructor();
|
|
7
|
-
static getInstance(): Promise<MunicipalitiesClass>;
|
|
8
|
-
protected getCollectionIndexes(): IndexDescription[];
|
|
9
|
-
protected getCollectionName(): string;
|
|
10
|
-
protected getEnvName(): string;
|
|
11
|
-
}
|
|
12
|
-
export declare const municipalities: MunicipalitiesClass;
|
|
13
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/* * */
|
|
2
|
-
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
3
|
-
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
4
|
-
/* * */
|
|
5
|
-
class MunicipalitiesClass extends MongoCollectionClass {
|
|
6
|
-
static _instance;
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
}
|
|
10
|
-
static async getInstance() {
|
|
11
|
-
if (!MunicipalitiesClass._instance) {
|
|
12
|
-
const instance = new MunicipalitiesClass();
|
|
13
|
-
await instance.connect();
|
|
14
|
-
MunicipalitiesClass._instance = instance;
|
|
15
|
-
}
|
|
16
|
-
return MunicipalitiesClass._instance;
|
|
17
|
-
}
|
|
18
|
-
getCollectionIndexes() {
|
|
19
|
-
return [];
|
|
20
|
-
}
|
|
21
|
-
getCollectionName() {
|
|
22
|
-
return 'municipalities';
|
|
23
|
-
}
|
|
24
|
-
getEnvName() {
|
|
25
|
-
return 'DATABASE_URI';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/* * */
|
|
29
|
-
export const municipalities = asyncSingletonProxy(MunicipalitiesClass);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
2
|
-
import { type Parish } from '@tmlmobilidade/types';
|
|
3
|
-
import { type IndexDescription } from 'mongodb';
|
|
4
|
-
declare class ParishesClass extends MongoCollectionClass<Parish, Parish, Parish> {
|
|
5
|
-
private static _instance;
|
|
6
|
-
private constructor();
|
|
7
|
-
static getInstance(): Promise<ParishesClass>;
|
|
8
|
-
protected getCollectionIndexes(): IndexDescription[];
|
|
9
|
-
protected getCollectionName(): string;
|
|
10
|
-
protected getEnvName(): string;
|
|
11
|
-
}
|
|
12
|
-
export declare const parishes: ParishesClass;
|
|
13
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/* * */
|
|
2
|
-
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
3
|
-
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
4
|
-
/* * */
|
|
5
|
-
class ParishesClass extends MongoCollectionClass {
|
|
6
|
-
static _instance;
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
}
|
|
10
|
-
static async getInstance() {
|
|
11
|
-
if (!ParishesClass._instance) {
|
|
12
|
-
const instance = new ParishesClass();
|
|
13
|
-
await instance.connect();
|
|
14
|
-
ParishesClass._instance = instance;
|
|
15
|
-
}
|
|
16
|
-
return ParishesClass._instance;
|
|
17
|
-
}
|
|
18
|
-
getCollectionIndexes() {
|
|
19
|
-
return [];
|
|
20
|
-
}
|
|
21
|
-
getCollectionName() {
|
|
22
|
-
return 'parishes';
|
|
23
|
-
}
|
|
24
|
-
getEnvName() {
|
|
25
|
-
return 'DATABASE_URI';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/* * */
|
|
29
|
-
export const parishes = asyncSingletonProxy(ParishesClass);
|