A vault — one self-contained space of notes, folders and links.
Two scopes:
"system"— created and owned by the organisation.owner_uuidis nil; admins holdingknowledge_base.manage_system_vaultsadminister them."user"— someone's personal vault.owner_uuidis the creator, and nobody else sees it unless they are added as a member.
Membership (PhoenixKitKnowledgeBase.Schemas.VaultMember) applies to both
scopes: it is what grants a specific person viewer / editor / owner
access to a specific vault.
[[wiki-links]] never cross a vault boundary — a vault is the resolution
namespace, exactly as an Obsidian vault is.
Summary
Functions
Changeset for creating or renaming a vault.
Marks a vault as the one a notes panel's path names (Places). Never cast:
the key is derived from the path, not taken from a form.
The scopes a vault may have.
Turns free text into a URL-safe slug.
Types
@type t() :: %PhoenixKitKnowledgeBase.Schemas.Vault{ __meta__: term(), created_by: term(), description: term(), directory: term(), folders: term(), icon: term(), inserted_at: term(), last_scanned_at: term(), members: term(), name: term(), notes: term(), owner_uuid: term(), path_key: term(), scope: term(), slug: term(), updated_at: term(), uuid: term() }
Functions
Changeset for creating or renaming a vault.
:slug is derived from the name when absent. :scope and :owner_uuid are
castable but the context — not the form — decides them, because "may this
person create a system vault?" is a permission question.
Marks a vault as the one a notes panel's path names (Places). Never cast:
the key is derived from the path, not taken from a form.
Both partial unique indexes are declared, so two people creating the same place's vault at once get a changeset error to recover from — not a raise.
@spec scopes() :: [String.t()]
The scopes a vault may have.
Turns free text into a URL-safe slug.
Returns nil for input that has no slug-able characters at all (e.g. a
name written entirely in a script this naive transliteration drops), so the
caller's validate_required(:slug) reports a real error instead of the
changeset quietly persisting "".