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.

56 lines (55 loc) 2.16 kB
import { MongoCollectionClass } from '../../mongo-collection.js'; import { CreateOrganizationDto, Organization, UpdateOrganizationDto } from '@tmlmobilidade/types'; import { IndexDescription, UpdateResult } from 'mongodb'; import { z } from 'zod'; declare class OrganizationsClass extends MongoCollectionClass<Organization, CreateOrganizationDto, UpdateOrganizationDto> { private static _instance; protected createSchema: z.ZodSchema; protected updateSchema: z.ZodSchema; private constructor(); static getInstance(): Promise<OrganizationsClass>; /** * Finds an organization by its code * * @param code - The code of the organization to find * @returns A promise that resolves to the matching organization document or null if not found */ findByCode(code: string): Promise<import("mongodb").WithId<{ _id: string; code: string; name: string; created_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; updated_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; }> | null>; /** * Updates an organization by its code * * @param code - The code of the organization to update * @param fields - The fields to update * @returns A promise that resolves to the result of the update operation */ updateByCode(code: string, fields: Partial<Organization>): Promise<UpdateResult<{ _id: string; code: string; name: string; created_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; updated_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; }>>; /** * Disable Update Many */ updateMany(): Promise<UpdateResult<Organization>>; protected getCollectionIndexes(): IndexDescription[]; protected getCollectionName(): string; protected getEnvName(): string; } export declare const organizations: OrganizationsClass; export {};