UNPKG

@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.

38 lines (37 loc) 1.28 kB
/* * */ import { MongoCollectionClass } from '../../common/mongo-collection.js'; import { asyncSingletonProxy } from '@tmlmobilidade/utils'; /* * */ class SimplifiedVehicleEventsClass extends MongoCollectionClass { static _instance; constructor() { super(); } static async getInstance() { if (!SimplifiedVehicleEventsClass._instance) { const instance = new SimplifiedVehicleEventsClass(); await instance.connect(); SimplifiedVehicleEventsClass._instance = instance; } return SimplifiedVehicleEventsClass._instance; } getCollectionIndexes() { return [ { background: true, key: { received_at: 1 } }, // eslint-disable-next-line perfectionist/sort-objects { background: true, key: { trip_id: 1, created_at: 1 } }, ]; } getCollectionName() { return 'simplified_vehicle_events'; } getEnvName() { return 'DATABASE_URI'; } } /* * */ /** * @deprecated This collection is no longer used and will be removed in a future release. * Use `simplifiedVehicleEventsNew` instead, which is the SQL version of this collection. */ export const simplifiedVehicleEvents = asyncSingletonProxy(SimplifiedVehicleEventsClass);