Liking cljdoc? Tell your friends :D

wagoe.user.shell.persistence

Shell layer for user module - implements user ports using database storage.

This namespace contains the SHELL (I/O) implementation that handles database persistence. In FC/IS architecture, this is the SHELL that:

  • Handles all I/O operations (database reads/writes)
  • Manages external system interactions
  • Contains side effects and impure operations
  • Implements wagoe.user.ports interfaces
  • Transforms between domain entities and database records

Key FC/IS principles:

  • ALL business logic stays in wagoe.user.core.*
  • This is ONLY for I/O and persistence concerns
  • No business decisions made here - only data transformation
  • Shell coordinates with core for business logic

This provides proper FC/IS separation where:

  • Core contains pure business logic (no I/O)
  • Shell handles all I/O and external systems
  • Clean boundary between functional and imperative code
Shell layer for user module - implements user ports using database storage.

This namespace contains the SHELL (I/O) implementation that handles database persistence.
In FC/IS architecture, this is the SHELL that:
- Handles all I/O operations (database reads/writes)
- Manages external system interactions
- Contains side effects and impure operations
- Implements wagoe.user.ports interfaces
- Transforms between domain entities and database records

Key FC/IS principles:
- ALL business logic stays in wagoe.user.core.*
- This is ONLY for I/O and persistence concerns
- No business decisions made here - only data transformation
- Shell coordinates with core for business logic

This provides proper FC/IS separation where:
- Core contains pure business logic (no I/O)
- Shell handles all I/O and external systems
- Clean boundary between functional and imperative code
raw docstring

create-audit-repositoryclj

(create-audit-repository ctx pagination-config)

Create a user audit log repository instance using database storage.

Args: ctx: Database context from wagoe.platform.shell.adapters.database.factory pagination-config: Pagination configuration map with :default-limit

Returns: DatabaseUserAuditRepository implementing IUserAuditRepository

Example: (create-audit-repository ctx pagination-config)

Create a user audit log repository instance using database storage.

Args:
  ctx: Database context from wagoe.platform.shell.adapters.database.factory
  pagination-config: Pagination configuration map with :default-limit
  
Returns:
  DatabaseUserAuditRepository implementing IUserAuditRepository
  
Example:
  (create-audit-repository ctx pagination-config)
sourceraw docstring

create-session-repositoryclj

(create-session-repository ctx)

Create a user session repository instance using database storage.

Args: ctx: Database context from wagoe.platform.shell.adapters.database.factory

Returns: DatabaseUserSessionRepository implementing IUserSessionRepository

Example: (create-session-repository ctx)

Create a user session repository instance using database storage.

Args:
  ctx: Database context from wagoe.platform.shell.adapters.database.factory
  
Returns:
  DatabaseUserSessionRepository implementing IUserSessionRepository
  
Example:
  (create-session-repository ctx)
sourceraw docstring

create-user-repositoryclj

(create-user-repository ctx)

Create a user repository instance using database storage.

Args: ctx: Database context from wagoe.platform.shell.adapters.database.factory

Returns: DatabaseUserRepository implementing IUserRepository

Example: (create-user-repository ctx)

Create a user repository instance using database storage.

Args:
  ctx: Database context from wagoe.platform.shell.adapters.database.factory
  
Returns:
  DatabaseUserRepository implementing IUserRepository
  
Example:
  (create-user-repository ctx)
sourceraw docstring

initialize-user-schema!clj

(initialize-user-schema! ctx)

Initialize database schema for user entities using Malli schema definitions.

Creates the following tables:

  • auth_users: Global authentication records (email, password, MFA, lockout)
  • users: Tenant-specific user profiles (name, role, avatar, preferences)
  • user_sessions: User authentication sessions
  • user_audit_log: Audit trail for user operations
  • user_identities: OpenID Connect (issuer, subject) links to users
  • user_groups, user_group_members: groups
  • user_roles, user_group_roles: managed roles and the roles of groups
  • user_group_grants: what groups held before roles, kept until 2.0

Includes indexes for:

  • Foreign keys (user_id)
  • Unique constraints (email, session tokens)
  • Query performance (role, active status, expiration dates)
  • Audit trail queries (target_user_id, actor_id, created_at)

Where the adapter claims :full-text (PostgreSQL), also creates:

  • search_vector GENERATED column for full-text search on users.name
  • GIN index on search_vector for fast full-text search queries

Note: This creates the split-table architecture for multi-tenancy support. Auth data lives in public.auth_users, profile data in tenant-specific users table.

Args: ctx: Database context

Returns: nil

Example: (initialize-user-schema! ctx)

Initialize database schema for user entities using Malli schema definitions.

Creates the following tables:
- auth_users: Global authentication records (email, password, MFA, lockout)
- users: Tenant-specific user profiles (name, role, avatar, preferences)
- user_sessions: User authentication sessions
- user_audit_log: Audit trail for user operations
- user_identities: OpenID Connect (issuer, subject) links to users
- user_groups, user_group_members: groups
- user_roles, user_group_roles: managed roles and the roles of groups
- user_group_grants: what groups held before roles, kept until 2.0

Includes indexes for:
- Foreign keys (user_id)
- Unique constraints (email, session tokens)
- Query performance (role, active status, expiration dates)
- Audit trail queries (target_user_id, actor_id, created_at)

Where the adapter claims :full-text (PostgreSQL), also creates:
- search_vector GENERATED column for full-text search on users.name
- GIN index on search_vector for fast full-text search queries

Note: This creates the split-table architecture for multi-tenancy support.
Auth data lives in public.auth_users, profile data in tenant-specific users table.

Args:
  ctx: Database context

Returns:
  nil

Example:
  (initialize-user-schema! ctx)
sourceraw docstring

session-token-hashclj

(session-token-hash token)

What user_sessions stores for token: its SHA-256, in hex. The token is 256 random bits, so an unsalted fast hash is enough, and a read of the table yields nothing a client can present (BOU-696).

What user_sessions stores for `token`: its SHA-256, in hex. The token is 256
random bits, so an unsalted fast hash is enough, and a read of the table
yields nothing a client can present (BOU-696).
sourceraw docstring

tablesclj

The user module's tables, by name, and the Malli schema each is built from.

The user module's tables, by name, and the Malli schema each is built from.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close