Data Layer medium complexity backend
0
Dependencies
0
Dependents
2
Entities
0
Integrations

Description

Data access layer responsible for reading and persisting organization settings records in the database. Provides typed query methods for fetching current settings and atomically updating individual setting groups. Handles support-access grant records and their expiry metadata.

Feature: Organization Settings

organization-settings-repository

Sources & reasoning

Phase 1 MVP admin scope (line 327) explicitly lists 'Organisasjonsinnstillinger'. admin-organization is always-on (line 241), making this non-deferrable. The support-access grant (line 259) is a hard tenant-isolation requirement across all organizations.

  • docs/source/likeperson.md · line 327-328
    Organisasjonsinnstillinger og terminologikonfigurasjon
  • docs/source/likeperson.md · line 241
    Admin Web Portal: admin-dashboard, admin-user-management, admin-organization, admin-security. admin-organization is always-on because it hosts the Feature Toggles UI itself
  • docs/source/likeperson.md · line 259
    Orgs can grant a Global Admin time-bounded support access via a flag in Organization Settings (e.g. "Allow Norse support access until {date}"); revoking the flag or hitting the expiry immediately removes access.

Responsibilities

  • Fetch the current settings record for a given organization
  • Persist updated contact details, locale preferences, and module configuration values
  • Store and retrieve support-access grant records with expiry timestamps
  • Provide atomic partial updates to avoid overwriting concurrent changes
  • Log all write operations for audit trail purposes

Interfaces

findByOrgId(orgId: string): Promise<OrganizationSettingsRecord | null>
upsertSettings(orgId: string, patch: Partial<OrganizationSettingsRecord>): Promise<OrganizationSettingsRecord>
saveSupportAccessGrant(orgId: string, grant: SupportAccessGrant): Promise<void>
deleteSupportAccessGrant(orgId: string): Promise<void>
getSupportAccessGrant(orgId: string): Promise<SupportAccessGrant | null>

Related Data Entities (2)

Data entities managed by this component