-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathtypes.py
More file actions
31 lines (22 loc) · 806 Bytes
/
types.py
File metadata and controls
31 lines (22 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import strawberry
from strawberry import ID
from api.context import Info
from api.pages.types import Page
from ..helpers.i18n import make_localized_resolver
@strawberry.type
class FAQ:
id: ID
question: str = strawberry.field(resolver=make_localized_resolver("question"))
answer: str = strawberry.field(resolver=make_localized_resolver("answer"))
@strawberry.type
class MenuLink:
href: str = strawberry.field(resolver=make_localized_resolver("href"))
title: str = strawberry.field(resolver=make_localized_resolver("title"))
is_primary: bool
page: Page | None
@strawberry.type
class Menu:
title: str = strawberry.field(resolver=make_localized_resolver("title"))
@strawberry.field
def links(self, info: Info) -> list[MenuLink]:
return self.links.all()