AP1.5c: Rekursive Projects fuer Mega-Programme ohne Stream-Typ.
Deploy Development / deploy (push) Successful in 53s
Test Suite / pytest-backend (push) Successful in 1m42s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 21s
Test Suite / playwright-smoke (push) Successful in 14s
Deploy Development / deploy (push) Successful in 53s
Test Suite / pytest-backend (push) Successful in 1m42s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 21s
Test Suite / playwright-smoke (push) Successful in 14s
parent_project_id und container_kind ermoeglichen verschachtelte Projektstruktur; Arbeitspakete bleiben an Blatt-Projekten gebunden. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
6eeddfdc76
commit
4ca0a2c460
15 files changed
+947
-91
No files matched your search
@@ -0,0 +1,12 @@
|
||||
-- AP1.5c: Rekursive Projects (parent_project_id, container_kind)
|
||||
|
||||
ALTER TABLE projects
|
||||
ADD COLUMN parent_project_id UUID NULL REFERENCES projects(id) ON DELETE SET NULL,
|
||||
ADD COLUMN container_kind VARCHAR(32) NULL
|
||||
CHECK (
|
||||
container_kind IS NULL
|
||||
OR container_kind IN ('project', 'stream', 'phase', 'release')
|
||||
);
|
||||
|
||||
CREATE INDEX idx_projects_parent ON projects(tenant_id, parent_project_id)
|
||||
WHERE parent_project_id IS NOT NULL;
|
||||
@@ -19,6 +19,8 @@ class ProjectCreateRequest(BaseModel):
|
||||
title: str = Field(min_length=1, max_length=255)
|
||||
description: str = ""
|
||||
status: Literal["active", "paused", "completed", "archived"] = "active"
|
||||
parent_project_id: Optional[str] = None
|
||||
container_kind: Optional[Literal["project", "stream", "phase", "release"]] = None
|
||||
roadmap_item_id: Optional[str] = None
|
||||
sort_order: int = 0
|
||||
target_date: Optional[date] = None
|
||||
@@ -28,6 +30,10 @@ class ProjectUpdateRequest(BaseModel):
|
||||
title: Optional[str] = Field(default=None, min_length=1, max_length=255)
|
||||
description: Optional[str] = None
|
||||
status: Optional[Literal["active", "paused", "completed", "archived"]] = None
|
||||
parent_project_id: Optional[str] = None
|
||||
clear_parent_project: bool = False
|
||||
container_kind: Optional[Literal["project", "stream", "phase", "release"]] = None
|
||||
clear_container_kind: bool = False
|
||||
roadmap_item_id: Optional[str] = None
|
||||
clear_roadmap_item: bool = False
|
||||
sort_order: Optional[int] = None
|
||||
@@ -62,6 +68,8 @@ def create_initiative_project(
|
||||
title=body.title,
|
||||
description=body.description,
|
||||
status=body.status,
|
||||
parent_project_id=body.parent_project_id,
|
||||
container_kind=body.container_kind,
|
||||
roadmap_item_id=body.roadmap_item_id,
|
||||
sort_order=body.sort_order,
|
||||
target_date=body.target_date,
|
||||
@@ -95,6 +103,10 @@ def update_project(
|
||||
title=body.title,
|
||||
description=body.description,
|
||||
status=body.status,
|
||||
parent_project_id=body.parent_project_id,
|
||||
clear_parent_project=body.clear_parent_project,
|
||||
container_kind=body.container_kind,
|
||||
clear_container_kind=body.clear_container_kind,
|
||||
roadmap_item_id=body.roadmap_item_id,
|
||||
clear_roadmap_item=body.clear_roadmap_item,
|
||||
sort_order=body.sort_order,
|
||||
@@ -113,7 +125,11 @@ def delete_project(
|
||||
project_id: str,
|
||||
ctx: TenantContext = Depends(require_capability("kairo.project.manage")),
|
||||
):
|
||||
if not project_service.delete_project(
|
||||
tenant_id=ctx.tenant_id, project_id=project_id, user_id=ctx.user_id
|
||||
):
|
||||
try:
|
||||
deleted = project_service.delete_project(
|
||||
tenant_id=ctx.tenant_id, project_id=project_id, user_id=ctx.user_id
|
||||
)
|
||||
except ValueError as exc:
|
||||
raise HTTPException(status_code=400, detail=str(exc)) from exc
|
||||
if not deleted:
|
||||
raise HTTPException(status_code=404, detail="Projekt nicht gefunden")
|
||||
@@ -9,6 +9,7 @@ from psycopg2.extras import RealDictCursor
|
||||
from db import get_connection
|
||||
from services.audit import log_audit
|
||||
from services.initiatives import PRIORITIES, get_initiative
|
||||
from services.projects import project_is_leaf
|
||||
|
||||
ActionStatus = Literal[
|
||||
"open", "ready", "in_progress", "blocked", "review_required", "done", "discarded"
|
||||
@@ -116,6 +117,10 @@ def _validate_project_in_initiative(
|
||||
)
|
||||
if not cur.fetchone():
|
||||
raise ValueError("Projekt gehört nicht zum Vorhaben")
|
||||
if not project_is_leaf(tenant_id=tenant_id, project_id=project_id):
|
||||
raise ValueError(
|
||||
"Arbeitspakete nur an Blatt-Projekten (ohne Unterprojekte)"
|
||||
)
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
+233
-10
@@ -1,4 +1,4 @@
|
||||
"""Project service — operative Struktur unter Initiative (AP1.5)."""
|
||||
"""Project service — operative Struktur unter Initiative (AP1.5, AP1.5c)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -14,15 +14,21 @@ from services.initiatives import get_initiative
|
||||
ProjectStatus = Literal["active", "paused", "completed", "archived"]
|
||||
PROJECT_STATUSES = frozenset({"active", "paused", "completed", "archived"})
|
||||
|
||||
ContainerKind = Literal["project", "stream", "phase", "release"]
|
||||
CONTAINER_KINDS = frozenset({"project", "stream", "phase", "release"})
|
||||
|
||||
MAX_PROJECT_DEPTH = 5
|
||||
|
||||
_PROJECT_COLUMNS = """
|
||||
id, tenant_id, initiative_id, title, description, status,
|
||||
id, tenant_id, initiative_id, parent_project_id, container_kind,
|
||||
title, description, status,
|
||||
roadmap_item_id, sort_order, target_date, created_at, updated_at
|
||||
"""
|
||||
|
||||
|
||||
def _serialize_row(row: dict[str, Any]) -> dict[str, Any]:
|
||||
result = dict(row)
|
||||
for key in ("id", "tenant_id", "initiative_id", "roadmap_item_id"):
|
||||
for key in ("id", "tenant_id", "initiative_id", "parent_project_id", "roadmap_item_id"):
|
||||
if result.get(key):
|
||||
result[key] = str(result[key])
|
||||
if result.get("target_date"):
|
||||
@@ -42,6 +48,11 @@ def _validate_status(status: str) -> None:
|
||||
raise ValueError(f"Ungültiger Project-Status: {status}")
|
||||
|
||||
|
||||
def _validate_container_kind(container_kind: Optional[str]) -> None:
|
||||
if container_kind is not None and container_kind not in CONTAINER_KINDS:
|
||||
raise ValueError(f"Ungültiger container_kind: {container_kind}")
|
||||
|
||||
|
||||
def _validate_roadmap_item(
|
||||
cur, *, tenant_id: str, initiative_id: str, roadmap_item_id: Optional[str]
|
||||
) -> None:
|
||||
@@ -59,6 +70,151 @@ def _validate_roadmap_item(
|
||||
raise ValueError("Gate/Plan-Element gehört nicht zu diesem Vorhaben")
|
||||
|
||||
|
||||
def _fetch_project_row(
|
||||
cur, *, tenant_id: str, project_id: str, initiative_id: Optional[str] = None
|
||||
) -> Optional[dict[str, Any]]:
|
||||
query = f"""
|
||||
SELECT {_PROJECT_COLUMNS}
|
||||
FROM projects
|
||||
WHERE id = %s AND tenant_id = %s
|
||||
"""
|
||||
params: list[Any] = [project_id, tenant_id]
|
||||
if initiative_id is not None:
|
||||
query += " AND initiative_id = %s"
|
||||
params.append(initiative_id)
|
||||
cur.execute(query, params)
|
||||
row = cur.fetchone()
|
||||
return dict(row) if row else None
|
||||
|
||||
|
||||
def _project_depth_from_map(
|
||||
project_id: str, by_id: dict[str, dict[str, Any]], memo: dict[str, int]
|
||||
) -> int:
|
||||
if project_id in memo:
|
||||
return memo[project_id]
|
||||
project = by_id.get(project_id)
|
||||
if not project or not project.get("parent_project_id"):
|
||||
memo[project_id] = 1
|
||||
return 1
|
||||
parent_id = str(project["parent_project_id"])
|
||||
if parent_id == project_id:
|
||||
raise ValueError("Zyklus in Project-Hierarchie")
|
||||
depth = _project_depth_from_map(parent_id, by_id, memo) + 1
|
||||
memo[project_id] = depth
|
||||
return depth
|
||||
|
||||
|
||||
def _collect_descendant_ids(
|
||||
project_id: str, by_parent: dict[str, list[str]]
|
||||
) -> set[str]:
|
||||
result: set[str] = set()
|
||||
stack = list(by_parent.get(project_id, []))
|
||||
while stack:
|
||||
child_id = stack.pop()
|
||||
if child_id in result:
|
||||
continue
|
||||
result.add(child_id)
|
||||
stack.extend(by_parent.get(child_id, []))
|
||||
return result
|
||||
|
||||
|
||||
def _subtree_height(project_id: str, by_parent: dict[str, list[str]]) -> int:
|
||||
children = by_parent.get(project_id, [])
|
||||
if not children:
|
||||
return 1
|
||||
return 1 + max(_subtree_height(child_id, by_parent) for child_id in children)
|
||||
|
||||
|
||||
def _load_initiative_project_maps(
|
||||
cur, *, tenant_id: str, initiative_id: str
|
||||
) -> tuple[dict[str, dict[str, Any]], dict[str, list[str]]]:
|
||||
cur.execute(
|
||||
f"""
|
||||
SELECT {_PROJECT_COLUMNS}
|
||||
FROM projects
|
||||
WHERE tenant_id = %s AND initiative_id = %s
|
||||
""",
|
||||
(tenant_id, initiative_id),
|
||||
)
|
||||
rows = [dict(r) for r in cur.fetchall()]
|
||||
by_id = {str(r["id"]): r for r in rows}
|
||||
by_parent: dict[str, list[str]] = {}
|
||||
for row in rows:
|
||||
parent_id = row.get("parent_project_id")
|
||||
if parent_id:
|
||||
by_parent.setdefault(str(parent_id), []).append(str(row["id"]))
|
||||
return by_id, by_parent
|
||||
|
||||
|
||||
def _validate_parent_project(
|
||||
cur,
|
||||
*,
|
||||
tenant_id: str,
|
||||
initiative_id: str,
|
||||
project_id: Optional[str],
|
||||
parent_project_id: Optional[str],
|
||||
) -> None:
|
||||
if not parent_project_id:
|
||||
return
|
||||
if project_id and parent_project_id == project_id:
|
||||
raise ValueError("Projekt kann nicht sein eigener Parent sein")
|
||||
|
||||
parent = _fetch_project_row(
|
||||
cur, tenant_id=tenant_id, project_id=parent_project_id, initiative_id=initiative_id
|
||||
)
|
||||
if not parent:
|
||||
raise ValueError("Parent-Projekt gehört nicht zu diesem Vorhaben")
|
||||
|
||||
by_id, by_parent = _load_initiative_project_maps(
|
||||
cur, tenant_id=tenant_id, initiative_id=initiative_id
|
||||
)
|
||||
if project_id:
|
||||
descendants = _collect_descendant_ids(project_id, by_parent)
|
||||
if parent_project_id in descendants:
|
||||
raise ValueError("Zyklus: Parent darf kein Nachfahr sein")
|
||||
|
||||
memo: dict[str, int] = {}
|
||||
parent_depth = _project_depth_from_map(parent_project_id, by_id, memo)
|
||||
subtree_height = (
|
||||
_subtree_height(project_id, by_parent) if project_id else 1
|
||||
)
|
||||
if parent_depth + subtree_height > MAX_PROJECT_DEPTH:
|
||||
raise ValueError(
|
||||
f"Maximale Project-Tiefe ({MAX_PROJECT_DEPTH}) würde überschritten"
|
||||
)
|
||||
|
||||
|
||||
def _attach_depths(projects: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
||||
if not projects:
|
||||
return projects
|
||||
by_id = {p["id"]: p for p in projects}
|
||||
memo: dict[str, int] = {}
|
||||
for project in projects:
|
||||
project["depth"] = _project_depth_from_map(project["id"], by_id, memo)
|
||||
project["has_children"] = any(
|
||||
other.get("parent_project_id") == project["id"] for other in projects
|
||||
)
|
||||
project["is_leaf"] = not project["has_children"]
|
||||
return projects
|
||||
|
||||
|
||||
def project_is_leaf(*, tenant_id: str, project_id: str) -> bool:
|
||||
conn = get_connection()
|
||||
try:
|
||||
with conn.cursor() as cur:
|
||||
cur.execute(
|
||||
"""
|
||||
SELECT 1 FROM projects
|
||||
WHERE parent_project_id = %s AND tenant_id = %s
|
||||
LIMIT 1
|
||||
""",
|
||||
(project_id, tenant_id),
|
||||
)
|
||||
return cur.fetchone() is None
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
def create_project(
|
||||
*,
|
||||
tenant_id: str,
|
||||
@@ -66,6 +222,8 @@ def create_project(
|
||||
title: str,
|
||||
description: str = "",
|
||||
status: ProjectStatus = "active",
|
||||
parent_project_id: Optional[str] = None,
|
||||
container_kind: Optional[ContainerKind] = None,
|
||||
roadmap_item_id: Optional[str] = None,
|
||||
sort_order: int = 0,
|
||||
target_date: Optional[date] = None,
|
||||
@@ -75,6 +233,7 @@ def create_project(
|
||||
if not title:
|
||||
raise ValueError("Titel ist erforderlich")
|
||||
_validate_status(status)
|
||||
_validate_container_kind(container_kind)
|
||||
if not get_initiative(tenant_id=tenant_id, initiative_id=initiative_id):
|
||||
raise ValueError("Initiative nicht gefunden")
|
||||
|
||||
@@ -87,18 +246,28 @@ def create_project(
|
||||
initiative_id=initiative_id,
|
||||
roadmap_item_id=roadmap_item_id,
|
||||
)
|
||||
_validate_parent_project(
|
||||
cur,
|
||||
tenant_id=tenant_id,
|
||||
initiative_id=initiative_id,
|
||||
project_id=None,
|
||||
parent_project_id=parent_project_id,
|
||||
)
|
||||
cur.execute(
|
||||
f"""
|
||||
INSERT INTO projects (
|
||||
tenant_id, initiative_id, title, description, status,
|
||||
tenant_id, initiative_id, parent_project_id, container_kind,
|
||||
title, description, status,
|
||||
roadmap_item_id, sort_order, target_date
|
||||
)
|
||||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)
|
||||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
|
||||
RETURNING {_PROJECT_COLUMNS}
|
||||
""",
|
||||
(
|
||||
tenant_id,
|
||||
initiative_id,
|
||||
parent_project_id,
|
||||
container_kind,
|
||||
title,
|
||||
description,
|
||||
status,
|
||||
@@ -116,7 +285,12 @@ def create_project(
|
||||
"project.created",
|
||||
user_id=user_id,
|
||||
tenant_id=tenant_id,
|
||||
details={"project_id": row["id"], "initiative_id": initiative_id, "title": title},
|
||||
details={
|
||||
"project_id": row["id"],
|
||||
"initiative_id": initiative_id,
|
||||
"title": title,
|
||||
"parent_project_id": parent_project_id,
|
||||
},
|
||||
)
|
||||
return row
|
||||
|
||||
@@ -139,7 +313,8 @@ def list_projects_for_initiative(
|
||||
""",
|
||||
(tenant_id, initiative_id),
|
||||
)
|
||||
return [_serialize_row(dict(r)) for r in cur.fetchall()]
|
||||
rows = [_serialize_row(dict(r)) for r in cur.fetchall()]
|
||||
return _attach_depths(rows)
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
@@ -150,16 +325,25 @@ def get_project(*, tenant_id: str, project_id: str) -> Optional[dict[str, Any]]:
|
||||
with conn.cursor(cursor_factory=RealDictCursor) as cur:
|
||||
cur.execute(
|
||||
f"""
|
||||
SELECT {_PROJECT_COLUMNS}
|
||||
SELECT initiative_id
|
||||
FROM projects WHERE id = %s AND tenant_id = %s
|
||||
""",
|
||||
(project_id, tenant_id),
|
||||
)
|
||||
row = cur.fetchone()
|
||||
return _serialize_row(dict(row)) if row else None
|
||||
if not row:
|
||||
return None
|
||||
initiative_id = str(row["initiative_id"])
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
for project in list_projects_for_initiative(
|
||||
tenant_id=tenant_id, initiative_id=initiative_id
|
||||
):
|
||||
if project["id"] == project_id:
|
||||
return project
|
||||
return None
|
||||
|
||||
|
||||
def update_project(
|
||||
*,
|
||||
@@ -169,6 +353,10 @@ def update_project(
|
||||
title: Optional[str] = None,
|
||||
description: Optional[str] = None,
|
||||
status: Optional[ProjectStatus] = None,
|
||||
parent_project_id: Optional[str] = None,
|
||||
clear_parent_project: bool = False,
|
||||
container_kind: Optional[ContainerKind] = None,
|
||||
clear_container_kind: bool = False,
|
||||
roadmap_item_id: Optional[str] = None,
|
||||
clear_roadmap_item: bool = False,
|
||||
sort_order: Optional[int] = None,
|
||||
@@ -195,6 +383,29 @@ def update_project(
|
||||
_validate_status(status)
|
||||
updates.append("status = %s")
|
||||
params.append(status)
|
||||
if clear_parent_project:
|
||||
updates.append("parent_project_id = NULL")
|
||||
elif parent_project_id is not None:
|
||||
conn = get_connection()
|
||||
try:
|
||||
with conn.cursor() as cur:
|
||||
_validate_parent_project(
|
||||
cur,
|
||||
tenant_id=tenant_id,
|
||||
initiative_id=existing["initiative_id"],
|
||||
project_id=project_id,
|
||||
parent_project_id=parent_project_id,
|
||||
)
|
||||
finally:
|
||||
conn.close()
|
||||
updates.append("parent_project_id = %s")
|
||||
params.append(parent_project_id)
|
||||
if clear_container_kind:
|
||||
updates.append("container_kind = NULL")
|
||||
elif container_kind is not None:
|
||||
_validate_container_kind(container_kind)
|
||||
updates.append("container_kind = %s")
|
||||
params.append(container_kind)
|
||||
if clear_roadmap_item:
|
||||
updates.append("roadmap_item_id = NULL")
|
||||
elif roadmap_item_id is not None:
|
||||
@@ -251,7 +462,7 @@ def update_project(
|
||||
tenant_id=tenant_id,
|
||||
details={"project_id": project_id},
|
||||
)
|
||||
return result
|
||||
return get_project(tenant_id=tenant_id, project_id=project_id)
|
||||
|
||||
|
||||
def delete_project(
|
||||
@@ -260,6 +471,18 @@ def delete_project(
|
||||
conn = get_connection()
|
||||
try:
|
||||
with conn.cursor() as cur:
|
||||
cur.execute(
|
||||
"""
|
||||
SELECT 1 FROM projects
|
||||
WHERE parent_project_id = %s AND tenant_id = %s
|
||||
LIMIT 1
|
||||
""",
|
||||
(project_id, tenant_id),
|
||||
)
|
||||
if cur.fetchone():
|
||||
raise ValueError(
|
||||
"Projekt hat Unterprojekte — zuerst löschen oder verschieben"
|
||||
)
|
||||
cur.execute(
|
||||
"UPDATE actions SET project_id = NULL WHERE project_id = %s AND tenant_id = %s",
|
||||
(project_id, tenant_id),
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
"""AP1.5c — Rekursive Projects (parent_project_id)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from tests.factories import provision_user_in_tenant
|
||||
from tests.test_initiatives_actions import (
|
||||
_auth,
|
||||
_create_initiative,
|
||||
_login,
|
||||
)
|
||||
|
||||
|
||||
def test_nested_projects_and_depth(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
initiative_id = _create_initiative(client, token).json()["id"]
|
||||
|
||||
root = client.post(
|
||||
f"/api/initiatives/{initiative_id}/projects",
|
||||
json={"title": "Programm", "container_kind": "project"},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert root.status_code == 201
|
||||
root_id = root.json()["id"]
|
||||
|
||||
stream = client.post(
|
||||
f"/api/initiatives/{initiative_id}/projects",
|
||||
json={
|
||||
"title": "Backend Stream",
|
||||
"parent_project_id": root_id,
|
||||
"container_kind": "stream",
|
||||
},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert stream.status_code == 201
|
||||
stream_id = stream.json()["id"]
|
||||
|
||||
leaf = client.post(
|
||||
f"/api/initiatives/{initiative_id}/projects",
|
||||
json={"title": "API", "parent_project_id": stream_id},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert leaf.status_code == 201
|
||||
leaf_id = leaf.json()["id"]
|
||||
|
||||
listed = client.get(
|
||||
f"/api/initiatives/{initiative_id}/projects",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert listed.status_code == 200
|
||||
items = {p["id"]: p for p in listed.json()}
|
||||
assert items[stream_id]["parent_project_id"] == root_id
|
||||
assert items[leaf_id]["depth"] == 3
|
||||
assert items[leaf_id]["is_leaf"] is True
|
||||
assert items[root_id]["has_children"] is True
|
||||
|
||||
|
||||
def test_action_only_on_leaf_project(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
initiative_id = _create_initiative(client, token).json()["id"]
|
||||
|
||||
parent = client.post(
|
||||
f"/api/initiatives/{initiative_id}/projects",
|
||||
json={"title": "Container"},
|
||||
headers=_auth(token),
|
||||
).json()
|
||||
child = client.post(
|
||||
f"/api/initiatives/{initiative_id}/projects",
|
||||
json={"title": "Blatt", "parent_project_id": parent["id"]},
|
||||
headers=_auth(token),
|
||||
).json()
|
||||
|
||||
blocked = client.post(
|
||||
f"/api/initiatives/{initiative_id}/actions",
|
||||
json={"title": "Am Container", "project_id": parent["id"]},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert blocked.status_code == 400
|
||||
assert "Blatt" in blocked.json()["detail"]
|
||||
|
||||
ok = client.post(
|
||||
f"/api/initiatives/{initiative_id}/actions",
|
||||
json={"title": "Am Blatt", "project_id": child["id"]},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert ok.status_code == 201
|
||||
|
||||
|
||||
def test_cannot_delete_project_with_children(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
initiative_id = _create_initiative(client, token).json()["id"]
|
||||
|
||||
parent = client.post(
|
||||
f"/api/initiatives/{initiative_id}/projects",
|
||||
json={"title": "Parent"},
|
||||
headers=_auth(token),
|
||||
).json()
|
||||
child = client.post(
|
||||
f"/api/initiatives/{initiative_id}/projects",
|
||||
json={"title": "Child", "parent_project_id": parent["id"]},
|
||||
headers=_auth(token),
|
||||
).json()
|
||||
|
||||
resp = client.delete(f"/api/projects/{parent['id']}", headers=_auth(token))
|
||||
assert resp.status_code == 400
|
||||
|
||||
client.delete(f"/api/projects/{child['id']}", headers=_auth(token))
|
||||
ok = client.delete(f"/api/projects/{parent['id']}", headers=_auth(token))
|
||||
assert ok.status_code == 204
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
APP_VERSION = "0.14.0-ap1.5"
|
||||
DB_SCHEMA_VERSION = "013"
|
||||
APP_VERSION = "0.14.1-ap1.5c"
|
||||
DB_SCHEMA_VERSION = "014"
|
||||
APP_NAME = "jinkendo-kairo"
|
||||
Reference in new issue
Block a user