luplo.core.systems¶
CRUD operations for the systems table.
Systems represent game systems or software components within a project
(e.g. “karma”, “vendor”, “banking”). The depends_on_system_ids array
tracks cross-system dependencies for impact analysis.
Functions¶
|
Create a new system within a project. |
|
Fetch a system by ID or hex prefix (≥8 chars). |
|
List all systems for a project, ordered by name. |
|
Update a system. Only fields explicitly passed are changed. |
Module Contents¶
- async luplo.core.systems.create_system(conn: psycopg.AsyncConnection[Any], *, project_id: str, name: str, description: str | None = None, depends_on_system_ids: list[str] | None = None, id: str | None = None) luplo.core.models.System¶
Create a new system within a project.
- Parameters:
conn – Async psycopg connection.
project_id – Owning project.
name – Unique name within the project.
description – Optional description.
depends_on_system_ids – IDs of systems this one depends on.
id – Optional ID override; auto-generated UUID4 if omitted.
- Returns:
The newly created
System.- Raises:
psycopg.errors.UniqueViolation – If (project_id, name) already exists.
- async luplo.core.systems.get_system(conn: psycopg.AsyncConnection[Any], system_id: str, *, project_id: str | None = None) luplo.core.models.System | None¶
Fetch a system by ID or hex prefix (≥8 chars).
Returns
Nonewhen nothing matches; raisesAmbiguousIdErrorwhen a prefix matches multiple rows. Pass project_id to scope prefix lookups to a single project.
- async luplo.core.systems.list_systems(conn: psycopg.AsyncConnection[Any], project_id: str) list[luplo.core.models.System]¶
List all systems for a project, ordered by name.
- async luplo.core.systems.update_system(conn: psycopg.AsyncConnection[Any], system_id: str, *, description: Any = _SENTINEL, depends_on_system_ids: Any = _SENTINEL, status: Any = _SENTINEL) luplo.core.models.System | None¶
Update a system. Only fields explicitly passed are changed.
Pass
Noneto clear a field. Omit (or pass nothing) to leave it unchanged.- Parameters:
conn – Async psycopg connection.
system_id – ID of the system to update.
description – New description,
Noneto clear, or omit.depends_on_system_ids – New dependency list,
Noneto clear, or omit.status – New status,
Noneto clear, or omit.
- Returns:
The updated
System, orNoneif not found.