-
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Replace django mptt with django tree queries for tests (#684)
Co-authored-by: Thiago Bellini Ribeiro <[email protected]>
- Loading branch information
1 parent
d55d956
commit 0b28264
Showing
11 changed files
with
189 additions
and
218 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from typing import TYPE_CHECKING, Annotated | ||
|
||
import strawberry | ||
from strawberry import relay | ||
from typing_extensions import TypeAlias | ||
|
||
import strawberry_django | ||
from strawberry_django.relay import ListConnectionWithTotalCount | ||
|
||
from .models import TreeNodeAuthor | ||
|
||
if TYPE_CHECKING: | ||
from .b import TreeNodeBookConnection | ||
|
||
|
||
@strawberry_django.type(TreeNodeAuthor) | ||
class TreeNodeAuthorType(relay.Node): | ||
name: str | ||
books: Annotated[ | ||
"TreeNodeBookConnection", strawberry.lazy("tests.relay.treenode.b") | ||
] = strawberry_django.connection() | ||
children: "TreeNodeAuthorConnection" = strawberry_django.connection() | ||
|
||
|
||
TreeNodeAuthorConnection: TypeAlias = ListConnectionWithTotalCount[TreeNodeAuthorType] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from typing import TYPE_CHECKING, Annotated | ||
|
||
import strawberry | ||
from strawberry import relay | ||
from typing_extensions import TypeAlias | ||
|
||
import strawberry_django | ||
from strawberry_django.relay import ListConnectionWithTotalCount | ||
|
||
from .models import TreeNodeBook | ||
|
||
if TYPE_CHECKING: | ||
from .a import TreeNodeAuthorType | ||
|
||
|
||
@strawberry_django.filter(TreeNodeBook) | ||
class TreeNodeBookFilter: | ||
name: str | ||
|
||
|
||
@strawberry_django.order(TreeNodeBook) | ||
class TreeNodeBookOrder: | ||
name: str | ||
|
||
|
||
@strawberry_django.type( | ||
TreeNodeBook, filters=TreeNodeBookFilter, order=TreeNodeBookOrder | ||
) | ||
class TreeNodeBookType(relay.Node): | ||
name: str | ||
author: Annotated["TreeNodeAuthorType", strawberry.lazy("tests.relay.treenode.a")] | ||
|
||
|
||
TreeNodeBookConnection: TypeAlias = ListConnectionWithTotalCount[TreeNodeBookType] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.