elioria-sst-x
    Preparing search index...

    Implements

    Index
    db: PostgresJsDatabase<packages/db/src/schema> & {}

    The db value.

    • Generated

      Executes countRelatedRecords.

      Parameters

      • id: string

        The id value.

      Returns Promise<{ collaborators: number; sectors: number; total: number }>

      The function result.

      Objective: In module packages/db/src/repositories/unit.repository.ts, run countRelatedRecords.

      Behavior: Async; accepts id; returns a value; invokes Promise.all.

    • Generated

      Executes delete.

      Parameters

      • id: string

        The id value.

      • tenantId: string

        The tenantId value.

      Returns Promise<boolean>

      The function result.

      Objective: In module packages/db/src/repositories/unit.repository.ts, run delete.

      Behavior: Async; accepts id and tenantId; returns a value; invokes this.db .select({ id: sectors.id }) .from(sectors) .where.

    • Generated

      Returns the result of findById.

      Parameters

      • id: string

        The id value.

      • tenantId: string

        The tenantId value.

      Returns Promise<Unit | null>

      The function result.

      Objective: In module packages/db/src/repositories/unit.repository.ts, retrieve data through findById.

      Behavior: Async; accepts id and tenantId; returns a value; invokes this.db .select() .from(units) .where.

    • Generated

      Returns the result of findByTenant.

      Parameters

      • tenantId: string

        The tenantId value.

      • OptionalcompanyId: string

        The companyId value.

      Returns Promise<Unit[]>

      The function result.

      Objective: In module packages/db/src/repositories/unit.repository.ts, retrieve data through findByTenant.

      Behavior: Async; accepts tenantId and companyId; returns a value; invokes this.db .select() .from(units) .where( companyId ? and(eq(un.

    • Generated

      Executes update.

      Parameters

      • id: string

        The id value.

      • tenantId: string

        The tenantId value.

      • data: Partial<
            {
                bairro: string;
                cep: string;
                cnaePrincipal: string;
                cnaePrincipalDescricao: string;
                cnaesSecundarios: { codigo: string; descricao: string }[];
                cnpj: string;
                complemento: string;
                grauRisco: number;
                isHeadquarters: boolean;
                lastCnpjLookupAt: Date;
                logradouro: string;
                municipio: string;
                name: string;
                nomeFantasia: string;
                numero: string;
                razaoSocial: string;
                registrationMode: "own_cnpj" | "inherit_headquarters";
                responsavelLegal: string;
                telefone: string;
                uf: string;
                unitType: "headquarters" | "branch" | "operational";
            },
        >

        The data value.

      Returns Promise<Unit | null>

      The function result.

      Objective: In module packages/db/src/repositories/unit.repository.ts, run update.

      Behavior: Async; accepts id and tenantId and data; returns a value; invokes this.db .update(units) .set(row) .where(and(eq(units.id, id).