elioria-sst-x
    Preparing search index...

    Class SupabaseInspectionFindingRepository

    Implements

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

    The db value.

    SORT_WHITELIST: Record<
        string,
        typeof inspectionFindings[keyof typeof inspectionFindings],
    > = ...
    • Generated

      Executes buildListConditions.

      Parameters

      • tenantId: string

        The tenantId value.

      • query: ListFindingsQuery

        The query value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns SQL<unknown>[]

      The function result.

      Objective: In module packages/db/src/repositories/inspection-finding.repository.ts, run buildListConditions.

      Behavior: accepts tenantId and query and filter; returns a value; invokes eq.

    • Generated

      Executes compareAndSetEscalation.

      Parameters

      • id: string

        The id value.

      • tenantId: string

        The tenantId value.

      • expectedLevel: string | null

        The expectedLevel value.

      • nextLevel: string

        The nextLevel value.

      • escalatedAt: Date

        The escalatedAt value.

      Returns Promise<InspectionFinding | null>

      The function result.

      Objective: In module packages/db/src/repositories/inspection-finding.repository.ts, run compareAndSetEscalation.

      Behavior: Async; accepts id and tenantId and expectedLevel and nextLevel and escalatedAt; returns a value; invokes eq.

    • Generated

      Returns the result of findById.

      Parameters

      • id: string

        The id value.

      • tenantId: string

        The tenantId value.

      Returns Promise<InspectionFinding | null>

      The function result.

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

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

    • Generated

      Returns the result of findByInspection.

      Parameters

      • inspectionId: string

        The inspectionId value.

      • tenantId: string

        The tenantId value.

      Returns Promise<InspectionFinding[]>

      The function result.

      Objective: In module packages/db/src/repositories/inspection-finding.repository.ts, retrieve data through findByInspection.

      Behavior: Async; accepts inspectionId and tenantId; returns a value; invokes this.db.select().from(inspectionFindings) .where(and(eq(insp.

    • Generated

      Returns the result of findByStatus.

      Parameters

      • tenantId: string

        The tenantId value.

      • status: InspectionFindingStatus

        The status value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<InspectionFinding[]>

      The function result.

      Objective: In module packages/db/src/repositories/inspection-finding.repository.ts, retrieve data through findByStatus.

      Behavior: Async; accepts tenantId and status and filter; returns a value; invokes eq.

    • Generated

      Returns the result of findByTenant.

      Parameters

      • tenantId: string

        The tenantId value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<InspectionFinding[]>

      The function result.

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

      Behavior: Async; accepts tenantId and filter; returns a value; invokes eq.

    • Hierarchy conditions for findings. Handles null-unit findings by falling back to the parent inspection's unit_id (which is NOT NULL).

      Parameters

      • tenantId: string
      • Optionalfilter: HierarchyFilter

      Returns SQL<unknown>[]

    • Generated

      Returns the result of listPaged.

      Parameters

      • tenantId: string

        The tenantId value.

      • query: ListFindingsQuery

        The query value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<PagedResult<InspectionFinding>>

      The function result.

      Objective: In module packages/db/src/repositories/inspection-finding.repository.ts, retrieve data through listPaged.

      Behavior: Async; accepts tenantId and query and filter; returns a value; invokes Math.max.

    • Generated

      Updates data through updateStatus.

      Parameters

      • id: string

        The id value.

      • tenantId: string

        The tenantId value.

      • status: InspectionFindingStatus

        The status value.

      • Optionaltimestamps: { closedAt?: Date }

        The timestamps value.

      Returns Promise<InspectionFinding | null>

      The function result.

      Objective: In module packages/db/src/repositories/inspection-finding.repository.ts, change data through updateStatus.

      Behavior: Async; accepts id and tenantId and status and timestamps; returns a value; invokes this.db.update(inspectionFindings).set({ status, ...extra }).