KIN-103: Добавить поддержку worktrees_enabled в PATCH /api/projects/{project_id}

- Добавлено поле worktrees_enabled: bool | None = None в класс ProjectPatch
- Добавлена проверка в has_any для обнаружения изменений
- Добавлена обработка поля при преобразовании в целое число для БД

DB schema и runner уже содержат поддержку worktrees_enabled.
GET /api/projects/{id} возвращает поле автоматически через SELECT *.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Gros Frumos 2026-03-17 20:18:51 +02:00
parent 8f5145eaac
commit 35d258935a

View file

@ -233,6 +233,7 @@ class ProjectPatch(BaseModel):
execution_mode: str | None = None execution_mode: str | None = None
autocommit_enabled: bool | None = None autocommit_enabled: bool | None = None
auto_test_enabled: bool | None = None auto_test_enabled: bool | None = None
worktrees_enabled: bool | None = None
obsidian_vault_path: str | None = None obsidian_vault_path: str | None = None
deploy_command: str | None = None deploy_command: str | None = None
deploy_host: str | None = None deploy_host: str | None = None
@ -251,7 +252,7 @@ class ProjectPatch(BaseModel):
def patch_project(project_id: str, body: ProjectPatch): def patch_project(project_id: str, body: ProjectPatch):
has_any = any([ has_any = any([
body.execution_mode, body.autocommit_enabled is not None, body.execution_mode, body.autocommit_enabled is not None,
body.auto_test_enabled is not None, body.auto_test_enabled is not None, body.worktrees_enabled is not None,
body.obsidian_vault_path, body.deploy_command is not None, body.obsidian_vault_path, body.deploy_command is not None,
body.deploy_host is not None, body.deploy_path is not None, body.deploy_host is not None, body.deploy_path is not None,
body.deploy_runtime is not None, body.deploy_restart_cmd is not None, body.deploy_runtime is not None, body.deploy_restart_cmd is not None,
@ -280,6 +281,8 @@ def patch_project(project_id: str, body: ProjectPatch):
fields["autocommit_enabled"] = int(body.autocommit_enabled) fields["autocommit_enabled"] = int(body.autocommit_enabled)
if body.auto_test_enabled is not None: if body.auto_test_enabled is not None:
fields["auto_test_enabled"] = int(body.auto_test_enabled) fields["auto_test_enabled"] = int(body.auto_test_enabled)
if body.worktrees_enabled is not None:
fields["worktrees_enabled"] = int(body.worktrees_enabled)
if body.obsidian_vault_path is not None: if body.obsidian_vault_path is not None:
fields["obsidian_vault_path"] = body.obsidian_vault_path fields["obsidian_vault_path"] = body.obsidian_vault_path
if body.deploy_command is not None: if body.deploy_command is not None: