-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GraphQL] re-init Strawberry + co-habitation with REST + Bruno setup. (…
…#37) * feat: setup bruno + strawberry gql * feat: rename `Formation` to `FormationDetails` * add bruno for search. * feat: add strawberry before all class/dataclass * fix: handle basics errors.
- Loading branch information
1 parent
bcb358d
commit 7791f11
Showing
18 changed files
with
374 additions
and
118 deletions.
There are no files selected for viewing
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
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"version": "1", | ||
"name": "bruno_onisep_explorer", | ||
"type": "collection" | ||
} |
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,22 @@ | ||
meta { | ||
name: geMainFormations | ||
type: http | ||
seq: 1 | ||
} | ||
|
||
post { | ||
url: http://127.0.0.1:5005/api/v1/formations/ | ||
body: json | ||
auth: none | ||
} | ||
|
||
headers { | ||
Content-Type: application/json | ||
} | ||
|
||
body:json { | ||
{ | ||
"offset": 0, | ||
"limit": 10 | ||
} | ||
} |
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,23 @@ | ||
meta { | ||
name: searchFormation | ||
type: http | ||
seq: 2 | ||
} | ||
|
||
post { | ||
url: http://localhost:5005/api/v1/formations/search | ||
body: json | ||
auth: none | ||
} | ||
|
||
headers { | ||
Content-Type: application/json | ||
} | ||
|
||
body:json { | ||
{ | ||
"limit": 10, | ||
"offset": 0, | ||
"query": "BTS SIO" | ||
} | ||
} |
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 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 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,24 @@ | ||
import strawberry | ||
from strawberry.extensions import MaxAliasesLimiter, MaxTokensLimiter, QueryDepthLimiter | ||
|
||
|
||
@strawberry.type | ||
class Book: | ||
title: str | ||
author: str | ||
|
||
|
||
@strawberry.type | ||
class Query: | ||
books: list[Book] | ||
|
||
|
||
schema = strawberry.Schema( | ||
query=Query, | ||
extensions=[ | ||
QueryDepthLimiter(max_depth=10), | ||
MaxTokensLimiter(max_token_count=1000), | ||
MaxAliasesLimiter(max_alias_count=15), | ||
], | ||
) | ||
# https://strawberry.rocks/docs/guides/tools |
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,12 @@ | ||
from flask import Blueprint, Response | ||
from strawberry.flask.views import GraphQLView | ||
|
||
from src.api.schema import schema | ||
|
||
graphql = Blueprint("graphql", __name__, url_prefix="/api/graphql") | ||
|
||
|
||
@graphql.route("/", methods=["POST", "GET"]) | ||
def gql() -> tuple[Response, int]: | ||
view = GraphQLView.as_view("graphql_view", schema=schema) | ||
return view() |
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 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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
from dataclasses import dataclass | ||
|
||
import strawberry | ||
|
||
|
||
@strawberry.type | ||
@dataclass | ||
class Job: | ||
id: str | ||
|
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 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
3 changes: 3 additions & 0 deletions
3
src/business_logic/formation/study/get_continuation_of_study.py
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 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 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 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 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