Data Layer medium complexity backend
0
Dependencies
4
Dependents
3
Entities
0
Integrations

Description

Data access layer for the organization_integrations table. Provides typed CRUD operations including reading and writing the JSONB field_mappings column and sync_schedule configuration. Handles Supabase RLS policy compliance for organization-scoped data access.

Feature: External System Integration Configuration

organization-integration-repository

Responsibilities

  • Provide typed CRUD for organization_integrations rows
  • Read and write JSONB field_mappings column with proper serialization
  • Enforce organization-scoped data isolation via Supabase RLS

Interfaces

create(record: NewOrgIntegration): Promise<OrgIntegration>
findById(id: string): Promise<OrgIntegration | null>
findByOrganization(orgId: string): Promise<OrgIntegration[]>
findByType(orgId: string, type: IntegrationType): Promise<OrgIntegration | null>
update(id: string, patch: Partial<OrgIntegration>): Promise<OrgIntegration>
delete(id: string): Promise<void>
updateFieldMappings(id: string, mappings: FieldMapping[]): Promise<void>
updateSyncSchedule(id: string, schedule: SyncSchedule): Promise<void>
updateHealthStatus(id: string, status: HealthCheckResult): Promise<void>