Data Layer medium complexity backend
0
Dependencies
1
Dependents
11
Entities
0
Integrations

Description

Data access layer abstracting all PostgreSQL queries against the users, organizations, user_role_assignments, and user_local_associations tables. Provides tenant-scoped query methods that automatically apply organization filtering based on the caller's context, ensuring data isolation between organizations at the query level.

Feature: User CRUD

user-repository

Responsibilities

  • Execute tenant-scoped CRUD queries against user-related tables
  • Build dynamic filter and search queries with pagination support
  • Manage user-organization and user-local-association relationships
  • Handle soft-delete semantics via active flag rather than hard deletion
  • Provide transaction support for multi-table user operations

Interfaces

findById(userId, organizationId)
findAll(filters, pagination, organizationId)
create(userData)
update(userId, updates, organizationId)
setActiveStatus(userId, active, organizationId)
findByEmail(email, organizationId)
countByOrganization(organizationId)
findByLocalAssociation(associationId, organizationId)
assignLocalAssociations(userId, associationIds)
removeLocalAssociations(userId, associationIds)
searchByNameOrEmail(query, organizationId, pagination)

Relationships

Dependents (1)

Components that depend on this component