refactor(clan_lib): move update to clan_lib.clan

This commit is contained in:
Johannes Kirschbauer
2025-06-09 12:16:45 +02:00
parent 7f478bffe2
commit ad948ec097
2 changed files with 2 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
from dataclasses import dataclass
from clan_lib.api import API
from clan_lib.flake import Flake
from clan_lib.nix_models.clan import InventoryMeta as Meta
from clan_lib.persist.inventory_store import InventorySnapshot, InventoryStore
from clan_lib.persist.util import set_value_by_path
@dataclass
class UpdateOptions:
flake: Flake
meta: Meta
@API.register
def update_clan_meta(options: UpdateOptions) -> InventorySnapshot:
inventory_store = InventoryStore(options.flake)
inventory = inventory_store.read()
set_value_by_path(inventory, "meta", options.meta)
inventory_store.write(inventory, message="Update clan metadata")
return inventory