elioria-sst-x
    Preparing search index...

    Class SupabaseInspectionStatsRepository

    Implements

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

    The db value.

    • Generated

      Executes actionsByStatus.

      Parameters

      • tenantId: string

        The tenantId value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<Record<string, number>>

      The function result.

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

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

    • Generated

      Executes averageScore.

      Parameters

      • tenantId: string
      • Optionalfilter: HierarchyFilter

      Returns Promise<number | null>

      The function result.

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

      Behavior: Async; accepts tenantId and filter; returns a value; invokes this.db .select({ avg: sql<number | null>avg(${inspections.. @param tenantId The tenantIdvalue. @param filter Thefilter` value.

    • Generated

      Executes averageScorePeriod.

      Parameters

      • tenantId: string
      • startDate: Date
      • endDate: Date
      • Optionalfilter: HierarchyFilter

      Returns Promise<number | null>

      The function result.

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

      Behavior: Async; accepts tenantId and startDate and endDate and filter; returns a value; invokes this.db .select({ avg: sql<number | null>avg(${inspections.. @param tenantId The tenantIdvalue. @param startDate ThestartDatevalue. @param endDate TheendDatevalue. @param filter Thefilter` value.

    • Generated

      Executes countActions.

      Parameters

      • tenantId: string

        The tenantId value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      • OptionaloverdueGroups: OverdueGroups

        The overdueGroups value.

      Returns Promise<{ completed: number; overdue: number; pending: number; total: number }>

      The function result.

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

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

    • Generated

      Executes countActionsPeriod.

      Parameters

      • tenantId: string

        The tenantId value.

      • startDate: Date

        The startDate value.

      • endDate: Date

        The endDate value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      • OptionaloverdueGroups: OverdueGroups

        The overdueGroups value.

      Returns Promise<{ completed: number; overdue: number; total: number }>

      The function result.

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

      Behavior: Async; accepts tenantId and startDate and endDate and filter and overdueGroups; returns a value; invokes overdueExprActions.

    • Generated

      Executes countAssets.

      Parameters

      • tenantId: string

        The tenantId value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<number>

      The function result.

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

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

    • Generated

      Executes countEffectiveness.

      Parameters

      • tenantId: string

        The tenantId value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<
          {
              effective: number;
              ineffective: number;
              partiallyEffective: number;
              pendingActions: number;
              totalVerifications: number;
          },
      >

      The function result.

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

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

    • Generated

      Executes countEfficacyPeriod.

      Parameters

      • tenantId: string

        The tenantId value.

      • startDate: Date

        The startDate value.

      • endDate: Date

        The endDate value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<
          {
              avgTreatmentDays: number;
              effective: number;
              totalActions: number;
              verified: number;
          },
      >

      The function result.

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

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

    • Generated

      Executes countEscalatedFindings.

      Parameters

      • tenantId: string

        The tenantId value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<number>

      The function result.

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

      Behavior: Async; accepts tenantId and filter; returns a value; invokes this.db .select({ count: sql<number>count(*) }) .from(insp.

    • Generated

      Executes countFindings.

      Parameters

      • tenantId: string

        The tenantId value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      • OptionaloverdueGroups: OverdueGroups

        The overdueGroups value.

      Returns Promise<{ critical: number; open: number; overdue: number; total: number }>

      The function result.

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

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

    • Generated

      Executes countFindingsPeriod.

      Parameters

      • tenantId: string

        The tenantId value.

      • startDate: Date

        The startDate value.

      • endDate: Date

        The endDate value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      • OptionaloverdueGroups: OverdueGroups

        The overdueGroups value.

      Returns Promise<{ critical: number; open: number; overdue: number; total: number }>

      The function result.

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

      Behavior: Async; accepts tenantId and startDate and endDate and filter and overdueGroups; returns a value; invokes overdueExprFindings.

    • Generated

      Executes countInspections.

      Parameters

      • tenantId: string

        The tenantId value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<
          {
              completed: number;
              inProgress: number;
              scheduled: number;
              total: number;
          },
      >

      The function result.

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

      Behavior: Async; accepts tenantId and filter; returns a value; invokes this.db .select({ total: sql<number>count(*), completed: s.

    • Generated

      Executes countInspectionsFull.

      Parameters

      • tenantId: string

        The tenantId value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<
          {
              cancelled: number;
              completed: number;
              inProgress: number;
              scheduled: number;
              total: number;
              underReview: number;
          },
      >

      The function result.

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

      Behavior: Async; accepts tenantId and filter; returns a value; invokes this.db .select({ total: sql<number>count(*), completed: s.

    • Generated

      Executes countInspectionsPeriod.

      Parameters

      • tenantId: string

        The tenantId value.

      • startDate: Date

        The startDate value.

      • endDate: Date

        The endDate value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<{ completed: number; total: number }>

      The function result.

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

      Behavior: Async; accepts tenantId and startDate and endDate and filter; returns a value; invokes this.db .select({ total: sql<number>count(*), completed: s.

    • Generated

      Executes countPgrLinkage.

      Parameters

      • tenantId: string

        The tenantId value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<{ linked: number; total: number; unlinked: number }>

      The function result.

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

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

    • Generated

      Executes countPrograms.

      Parameters

      • tenantId: string

        The tenantId value.

      Returns Promise<{ active: number; total: number }>

      The function result.

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

      Behavior: Async; accepts tenantId; returns a value; invokes this.db .select({ total: sql<number>count(*), active: sql<.

    • Generated

      Executes countRiskEvolution.

      Parameters

      • tenantId: string

        The tenantId value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<
          {
              increased: number;
              notComparable: number;
              pendingPostControl: number;
              reduced: number;
              totalAssessed: number;
              unchanged: number;
          },
      >

      The function result.

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

      Behavior: Async; accepts tenantId and filter; returns a value; invokes this.db.execute.

    • Generated

      Executes countTemplates.

      Parameters

      • tenantId: string

        The tenantId value.

      Returns Promise<{ published: number; total: number }>

      The function result.

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

      Behavior: Async; accepts tenantId; returns a value; invokes this.db .select({ total: sql<number>count(*), published: s.

    • Generated

      Executes findingsByClassification7020.

      Parameters

      • tenantId: string

        The tenantId value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<Record<string, number>>

      The function result.

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

      Behavior: Async; accepts tenantId and filter; returns a value; invokes this.db .select({ classification: inspectionFindings.classif.

    • Generated

      Executes findingsByCriticality.

      Parameters

      • tenantId: string

        The tenantId value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<Record<string, number>>

      The function result.

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

      Behavior: Async; accepts tenantId and filter; returns a value; invokes this.db .select({ criticality: inspectionFindings.criticalit.

    • Generated

      Executes findingsByStatus.

      Parameters

      • tenantId: string

        The tenantId value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<Record<string, number>>

      The function result.

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

      Behavior: Async; accepts tenantId and filter; returns a value; invokes this.db .select({ status: inspectionFindings.status, count: .

    • Generated

      Executes findingsByType.

      Parameters

      • tenantId: string

        The tenantId value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<Record<string, number>>

      The function result.

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

      Behavior: Async; accepts tenantId and filter; returns a value; invokes this.db .select({ findingType: inspectionFindings.findingTyp.

    • Generated

      Executes inspectionsByMonth.

      Parameters

      • tenantId: string

        The tenantId value.

      • months: number

        The months value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<{ avgScore: number | null; count: number; month: string }[]>

      The function result.

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

      Behavior: Async; accepts tenantId and months and filter; returns a value; invokes cutoff.setMonth.

    • Generated

      Executes recurrenceAnalysis.

      Parameters

      • tenantId: string

        The tenantId value.

      • limit: number = 10

        The limit value.

      • Optionalfilter: HierarchyFilter

        The filter value.

      Returns Promise<RecurrenceAnalysis[]>

      The function result.

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

      Behavior: Async; accepts tenantId and limit and filter; returns a value; invokes this.db .select({ entityId: inspectionFindings.assetId, find.