@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.
150 lines (149 loc) • 5.05 kB
TypeScript
import { MongoCollectionClass } from '../../common/mongo-collection.js';
import { type CreateZoneDto, type UpdateZoneDto, type 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<{
_id: string;
created_at: number & {
__brand: "UnixTimestamp";
};
created_by: string | null;
is_locked: boolean;
updated_at: number & {
__brand: "UnixTimestamp";
};
code: string;
name: string;
agency_ids: string[];
geojson: {
type: "Feature";
geometry: {
type: "Polygon";
coordinates: number[][][];
} | {
type: "MultiPolygon";
coordinates: number[][][][];
};
properties?: Record<string, any> | null | undefined;
} | {
type: "FeatureCollection";
features: {
type: "Feature";
geometry: {
type: "Polygon";
coordinates: number[][][];
} | {
type: "MultiPolygon";
coordinates: number[][][][];
};
properties?: Record<string, any> | null | undefined;
}[];
} | null;
updated_by?: string | undefined;
}>>;
/**
* 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<{
_id: string;
created_at: number & {
__brand: "UnixTimestamp";
};
created_by: string | null;
is_locked: boolean;
updated_at: number & {
__brand: "UnixTimestamp";
};
code: string;
name: string;
agency_ids: string[];
geojson: {
type: "Feature";
geometry: {
type: "Polygon";
coordinates: number[][][];
} | {
type: "MultiPolygon";
coordinates: number[][][][];
};
properties?: Record<string, any> | null | undefined;
} | {
type: "FeatureCollection";
features: {
type: "Feature";
geometry: {
type: "Polygon";
coordinates: number[][][];
} | {
type: "MultiPolygon";
coordinates: number[][][][];
};
properties?: Record<string, any> | null | undefined;
}[];
} | null;
updated_by?: string | undefined;
}>>;
/**
* 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<{
_id: string;
created_at: number & {
__brand: "UnixTimestamp";
};
created_by: string | null;
is_locked: boolean;
updated_at: number & {
__brand: "UnixTimestamp";
};
code: string;
name: string;
agency_ids: string[];
geojson: {
type: "Feature";
geometry: {
type: "Polygon";
coordinates: number[][][];
} | {
type: "MultiPolygon";
coordinates: number[][][][];
};
properties?: Record<string, any> | null | undefined;
} | {
type: "FeatureCollection";
features: {
type: "Feature";
geometry: {
type: "Polygon";
coordinates: number[][][];
} | {
type: "MultiPolygon";
coordinates: number[][][][];
};
properties?: Record<string, any> | null | undefined;
}[];
} | null;
updated_by?: string | undefined;
}>>;
protected getCollectionIndexes(): IndexDescription[];
protected getCollectionName(): string;
protected getEnvName(): string;
}
export declare const zones: ZonesClass;
export {};