Skip to content

Commit a930986

Browse files
ImTotemclaude
andcommitted
fix(graphql): convert nested DailyClick dicts to Strawberry types
model_dump() converts nested Pydantic models to dicts, but Strawberry expects typed objects. Manually wrap daily_clicks dicts in DailyClickType for link detail query. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a792c73 commit a930986

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/bcsd_api/shorten/resolvers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from .types import (
1111
CreateLinkInput,
1212
CreatorOptionType,
13+
DailyClickType,
1314
LinkDetailType,
1415
LinkFilterInput,
1516
LinkFiltersType,
@@ -42,7 +43,9 @@ def resolve_links(
4243
def resolve_link(info: Info[GqlContext, None], id: strawberry.ID) -> LinkDetailType:
4344
require_user(info.context)
4445
d = service.get_detail(info.context.link_repo, id)
45-
return from_model(d, LinkDetailType)
46+
data = d.model_dump()
47+
data["daily_clicks"] = [DailyClickType(**c) for c in data["daily_clicks"]]
48+
return LinkDetailType(**data)
4649

4750

4851
def resolve_link_filters(info: Info[GqlContext, None]) -> LinkFiltersType:

0 commit comments

Comments
 (0)