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.

80 lines (79 loc) 2.95 kB
import { MongoCollectionClass } from '../../common/mongo-collection.js'; import { type CreateEventDto, type Event, type UpdateEventDto } from '@tmlmobilidade/types'; import { IndexDescription } from 'mongodb'; import { z } from 'zod'; declare class EventsClass extends MongoCollectionClass<Event, CreateEventDto, UpdateEventDto> { private static _instance; protected createSchema: z.ZodSchema; protected updateSchema: z.ZodSchema; private constructor(); static getInstance(): Promise<EventsClass>; /** * Finds Event documents by agency IDs. * * @param ids - The agency IDs to search for * @returns A promise that resolves to an array of matching documents */ findByAgencyIds(ids: string[]): Promise<import("mongodb").WithId<{ _id: string; created_at: number & { __brand: "UnixTimestamp"; }; created_by: string | null; is_locked: boolean; updated_at: number & { __brand: "UnixTimestamp"; }; code: string; description: string; title: string; agency_ids: string[]; dates: import("@tmlmobilidade/types").OperationalDate[]; rules: ({ event: { title: string; id: string; }; dates: import("@tmlmobilidade/types").OperationalDate[]; kind: "event_restriction"; lines_mode: "exclude" | "include" | "all"; all_day: boolean; end_time: string & z.BRAND<"HHMM">; start_time: string & z.BRAND<"HHMM">; _id?: string | undefined; name?: string | undefined; timepoints?: (string & z.BRAND<"HHMM">)[] | undefined; lines_to_exclude?: string[] | undefined; lines_to_include?: string[] | undefined; } | { event: { title: string; id: string; }; dates: import("@tmlmobilidade/types").OperationalDate[]; kind: "event_replacement"; weekdays: (1 | 2 | 4 | 3 | 5 | 6 | 7)[]; year_period_ids: string[]; lines_mode: "exclude" | "include" | "all"; _id?: string | undefined; name?: string | undefined; timepoints?: (string & z.BRAND<"HHMM">)[] | undefined; lines_to_exclude?: string[] | undefined; lines_to_include?: string[] | undefined; same_weekday?: boolean | undefined; })[]; associated_patterns: { _id: string; code: string; headsign: string; line_id: string; route_id: string; }[]; updated_by?: string | undefined; }>[]>; protected getCollectionIndexes(): IndexDescription[]; protected getCollectionName(): string; protected getEnvName(): string; } export declare const events: EventsClass; export {};