@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) • 1.04 kB
JavaScript
/* * */
import { MongoCollectionClass } from '../../mongo-collection.js';
import { HashedShapeSchema, UpdateHashedShapeSchema } from '@tmlmobilidade/types';
import { AsyncSingletonProxy } from '@tmlmobilidade/utils';
/* * */
class HashedShapesClass extends MongoCollectionClass {
static _instance;
createSchema = HashedShapeSchema;
updateSchema = UpdateHashedShapeSchema;
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 'TML_INTERFACE_HASHED_SHAPES';
}
}
/* * */
export const hashedShapes = AsyncSingletonProxy(HashedShapesClass);