Skip to content

Commit 826dd14

Browse files
committed
add checks for title on usecase update
1 parent dfa3e0d commit 826dd14

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

api/schema/usecase_schema.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ class UseCaseInputPartial:
6464
"""Input type for use case updates."""
6565

6666
id: str
67-
title: auto
68-
summary: auto
69-
platform_url: auto
70-
tags: auto
71-
sectors: auto
72-
started_on: auto
73-
completed_on: auto
7467
logo: auto
7568
running_status: auto
69+
title: Optional[str] = None
70+
summary: Optional[str] = None
71+
platform_url: Optional[str] = None
72+
tags: Optional[List[str]] = None
73+
sectors: Optional[List[uuid.UUID]] = None
74+
started_on: Optional[datetime.date] = None
75+
completed_on: Optional[datetime.date] = None
7676

7777

7878
@strawberry.type(name="Query")
@@ -357,9 +357,9 @@ def update_use_case(self, info: Info, data: UseCaseInputPartial) -> TypeUseCase:
357357
if usecase.status != UseCaseStatus.DRAFT:
358358
raise ValueError(f"UseCase with ID {usecase_id} is not in draft status.")
359359

360-
if data.title.strip() == "":
361-
raise ValueError("Title cannot be empty.")
362360
if data.title is not None:
361+
if data.title.strip() == "":
362+
raise ValueError("Title cannot be empty.")
363363
usecase.title = data.title.strip()
364364
if data.summary is not None:
365365
usecase.summary = data.summary.strip()

0 commit comments

Comments
 (0)