luplo.core.actors

CRUD operations for the actors table.

Actors are attribution labels — “who wrote this” metadata referenced as FK on items, history, and audit rows. They are not authenticated principals: luplo core does not know about passwords, sessions, or OAuth. A deployment that needs authentication layers it on top and translates its own user identities into actor_id before calling luplo.

After 0002 migration, actors.id is a UUID (string in Python). After 0006 migration, password_hash / is_admin / last_login_at / oauth_provider / oauth_subject are removed.

Functions

create_actor(→ luplo.core.models.Actor)

Create a new actor.

get_actor(→ luplo.core.models.Actor | None)

Fetch an actor by ID. Returns None if not found.

get_actor_by_email(→ luplo.core.models.Actor | None)

Look up an actor by email. Returns None if not found.

Module Contents

async luplo.core.actors.create_actor(conn: psycopg.AsyncConnection[Any], *, name: str, email: str, role: str | None = None, external_ids: dict[str, str] | None = None, id: str | None = None) luplo.core.models.Actor

Create a new actor.

Parameters:
  • conn – Async psycopg connection.

  • name – Display name.

  • email – Unique email (required after 0002). Used as an attribution label, not an authentication identifier.

  • role – Optional role description.

  • external_ids – Optional mapping of external system IDs.

  • id – Optional UUID string; auto-generated UUID4 if omitted.

Returns:

The newly created Actor.

Raises:

psycopg.errors.UniqueViolation – If email already exists.

async luplo.core.actors.get_actor(conn: psycopg.AsyncConnection[Any], actor_id: str) luplo.core.models.Actor | None

Fetch an actor by ID. Returns None if not found.

async luplo.core.actors.get_actor_by_email(conn: psycopg.AsyncConnection[Any], email: str) luplo.core.models.Actor | None

Look up an actor by email. Returns None if not found.