@tmlmobilidade/interfaces
Version:
This package provides SDK-style connectors for interacting with databases (e.g., stops, plans, rides, alerts) and external providers (e.g., authentication, storage). It simplifies data access and integration across projects.
35 lines (34 loc) • 993 B
JavaScript
/* * */
import { MongoCollectionClass } from '../../common/mongo-collection.js';
import { DocumentSchema } from '@tmlmobilidade/types';
import { asyncSingletonProxy } from '@tmlmobilidade/utils';
/* * */
class HashedShapesClass extends MongoCollectionClass {
static _instance;
createSchema = DocumentSchema;
updateSchema = DocumentSchema;
constructor() {
super();
}
static async getInstance() {
if (!HashedShapesClass._instance) {
const instance = new HashedShapesClass();
await instance.connect();
HashedShapesClass._instance = instance;
}
return HashedShapesClass._instance;
}
getCollectionIndexes() {
return [
{ background: true, key: { agency_id: 1 } },
];
}
getCollectionName() {
return 'hashed_shapes';
}
getEnvName() {
return 'DATABASE_URI';
}
}
/* * */
export const hashedShapes = asyncSingletonProxy(HashedShapesClass);