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.

48 lines (47 loc) 1.57 kB
/* eslint-disable @typescript-eslint/no-explicit-any */ /* * */ import { MongoCollectionClass } from '../../common/mongo-collection.js'; import { CreateFileExportSchema, UpdateFileExportSchema } from '@tmlmobilidade/types'; import { asyncSingletonProxy } from '@tmlmobilidade/utils'; /* * */ class FileExportsClass extends MongoCollectionClass { // // // static _instance; createSchema = CreateFileExportSchema; updateSchema = UpdateFileExportSchema; constructor() { super(); } static async getInstance() { if (!FileExportsClass._instance) { const instance = new FileExportsClass(); await instance.connect(); FileExportsClass._instance = instance; } return FileExportsClass._instance; } getCollectionIndexes() { return [ { background: true, key: { file_name: 1 } }, { background: true, key: { processing_status: 1 } }, { background: true, key: { scope: 1 } }, { background: true, key: { type: 1 } }, { background: true, expireAfterSeconds: 60_000 * 4 * 60, key: { created_at: 1 } }, // 4 hours { background: true, key: { updated_at: 1 } }, ]; } getCollectionName() { return 'exports'; } getEnvName() { return 'DATABASE_URI'; } } /* * */ /** * @deprecated This class is deprecated and will be removed in the future. * Use `@tmlmobilidade/go-interfaces-go-db` instead. */ export const fileExports = asyncSingletonProxy(FileExportsClass);