(accept-external-invite! this request)Atomically accept a pending external invite.
Request shape: {:token raw-token :accepted-by-user-id uuid :tx-context optional-db-tx :hooks {:after-accept-tx (fn [{:keys [invite membership tx-context]}] ...)}}
Returns: {:invite updated-invite :membership created-membership :effects {:after-accept-tx hook-result}}
Atomically accept a pending external invite.
Request shape:
{:token raw-token
:accepted-by-user-id uuid
:tx-context optional-db-tx
:hooks {:after-accept-tx (fn [{:keys [invite membership tx-context]}] ...)}}
Returns:
{:invite updated-invite
:membership created-membership
:effects {:after-accept-tx hook-result}}(load-external-invite-for-acceptance this request)Resolve a pending invite for an acceptance flow.
Request shape: {:token raw-token :tx-context optional-db-tx}
Returns: Pending invite entity
Throws:
Resolve a pending invite for an acceptance flow.
Request shape:
{:token raw-token
:tx-context optional-db-tx}
Returns:
Pending invite entity
Throws:
- :not-found when no pending invite exists for the token
- :validation-error when the invite has expired(create-invite this invite-entity)(find-invite-by-id this invite-id)(find-invites-by-tenant this tenant-id options)(find-pending-invite-by-email-and-tenant this tenant-id email)(find-pending-invite-by-token-hash this token-hash)(update-invite this invite-entity)(accept-external-invite this token accepted-by-user-id)(get-external-invite this invite-id)(get-external-invite-by-token this token)(invite-external-member this tenant-id email role options)(list-tenant-invites this tenant-id options)(revoke-external-invite this invite-id)(create-membership this membership-entity)(find-membership-by-id this membership-id)(find-membership-by-user-and-tenant this user-id tenant-id)(find-memberships-by-tenant this tenant-id options)(find-memberships-by-user this user-id)(membership-exists? this user-id tenant-id)(update-membership this membership-entity)(accept-invitation this membership-id)(bootstrap-first-member this tenant-id user-id role)(update-member-role this membership-id role)(list-tenant-members this tenant-id options)(bootstrap-open? this tenant-id)(get-membership this membership-id)(invite-user this tenant-id user-id role)(get-active-membership this user-id tenant-id)(suspend-member this membership-id)(revoke-member this membership-id)(create-tenant-schema this schema-name)(find-all-tenants this options)(find-tenant-by-id this tenant-id)(drop-tenant-schema this schema-name)(create-tenant this tenant-entity)(tenant-slug-exists? this slug)(update-tenant this tenant-entity)(delete-tenant this tenant-id)(find-tenant-by-slug this slug)Protocol for executing code within a tenant's database schema context.
This protocol abstracts tenant schema switching operations, allowing different implementations for different database types (PostgreSQL vs others).
Protocol for executing code within a tenant's database schema context. This protocol abstracts tenant schema switching operations, allowing different implementations for different database types (PostgreSQL vs others).
(list-tenant-schemas this db-ctx)List all tenant_* schemas in the database. Returns a vector of schema name strings. Returns empty vector for non-PostgreSQL databases.
List all tenant_* schemas in the database. Returns a vector of schema name strings. Returns empty vector for non-PostgreSQL databases.
(tenant-provisioned? this db-ctx tenant-entity)Check if a tenant's database schema has been provisioned. Returns true if the schema exists in PostgreSQL, false otherwise. Returns false for non-PostgreSQL databases.
Check if a tenant's database schema has been provisioned. Returns true if the schema exists in PostgreSQL, false otherwise. Returns false for non-PostgreSQL databases.
(with-tenant-schema this db-ctx schema-name f)Execute function f within the specified tenant schema context.
For PostgreSQL: Sets search_path to tenant schema for the duration of f For other databases: May use row-level filtering or other mechanisms
Args: db-ctx: Database context map with :datasource schema-name: Tenant schema name (e.g., 'tenant_acme_corp') f: Function to execute, receives transaction context as argument
Returns: Result of executing f
Throws: ex-info with :type :unsupported-database if database doesn't support schemas ex-info with :type :schema-not-found if schema doesn't exist
Execute function f within the specified tenant schema context. For PostgreSQL: Sets search_path to tenant schema for the duration of f For other databases: May use row-level filtering or other mechanisms Args: db-ctx: Database context map with :datasource schema-name: Tenant schema name (e.g., 'tenant_acme_corp') f: Function to execute, receives transaction context as argument Returns: Result of executing f Throws: ex-info with :type :unsupported-database if database doesn't support schemas ex-info with :type :schema-not-found if schema doesn't exist
(activate-tenant this tenant-id)(create-new-tenant this tenant-input)(delete-existing-tenant this tenant-id)(get-tenant this tenant-id)(get-tenant-by-slug this slug)(list-tenants this options)(suspend-tenant this tenant-id)(update-existing-tenant this tenant-id update-data)cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |