@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.
39 lines (38 loc) • 1.63 kB
TypeScript
import { MongoCollectionClass } from '../../mongo-collection.js';
import { CreateZoneDto, UpdateZoneDto, Zone } from '@tmlmobilidade/types';
import { IndexDescription } from 'mongodb';
import { z } from 'zod';
declare class ZonesClass extends MongoCollectionClass<Zone, CreateZoneDto, UpdateZoneDto> {
private static _instance;
protected createSchema: z.ZodSchema;
protected updateSchema: z.ZodSchema;
private constructor();
static getInstance(): Promise<ZonesClass>;
/**
* Finds a zone document by its code.
*
* @param code - The code of the zone to find
* @returns A promise that resolves to the matching zone document or null if not found
*/
findByCode(code: string): Promise<import("mongodb").WithId<Zone> | null>;
/**
* Finds a zone document by its name.
*
* @param name - The name of the zone to find
* @returns A promise that resolves to the matching zone document or null if not found
*/
findByName(name: string): Promise<import("mongodb").WithId<Zone> | null>;
/**
* Updates a zone document by its code.
*
* @param code - The code of the zone to update.
* @param updateFields - The fields to update in the zone document.
* @returns A promise that resolves to the result of the update operation.
*/
updateByCode(code: string, updateFields: Partial<Zone>): Promise<import("mongodb").UpdateResult<Zone>>;
protected getCollectionIndexes(): IndexDescription[];
protected getCollectionName(): string;
protected getEnvName(): string;
}
export declare const zones: ZonesClass;
export {};