ohmyapi 0.1.17__tar.gz → 0.1.18__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/PKG-INFO +5 -5
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/README.md +4 -4
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/pyproject.toml +1 -1
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/db/model/model.py +2 -14
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/__init__.py +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/__main__.py +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/builtin/auth/__init__.py +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/builtin/auth/models.py +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/builtin/auth/permissions.py +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/builtin/auth/routes.py +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/cli.py +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/core/__init__.py +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/core/runtime.py +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/core/scaffolding.py +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/core/templates/app/__init__.py.j2 +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/core/templates/app/models.py.j2 +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/core/templates/app/routes.py.j2 +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/core/templates/project/README.md.j2 +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/core/templates/project/pyproject.toml.j2 +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/core/templates/project/settings.py.j2 +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/db/__init__.py +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/db/exceptions.py +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/db/model/__init__.py +0 -0
- {ohmyapi-0.1.17 → ohmyapi-0.1.18}/src/ohmyapi/router.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ohmyapi
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.18
|
4
4
|
Summary: A Django-like but async web-framework based on FastAPI and TortoiseORM.
|
5
5
|
License-Expression: MIT
|
6
6
|
Keywords: fastapi,tortoise,orm,async,web-framework
|
@@ -167,14 +167,14 @@ router = APIRouter(prefix="/tournament", tags=['Tournament'])
|
|
167
167
|
@router.get("/")
|
168
168
|
async def list():
|
169
169
|
queryset = Tournament.all()
|
170
|
-
return await Tournament.Schema.
|
170
|
+
return await Tournament.Schema.model.from_queryset(queryset)
|
171
171
|
|
172
172
|
|
173
173
|
@router.get("/:id")
|
174
174
|
async def get(id: str):
|
175
175
|
try:
|
176
176
|
tournament = await Tournament.get(pk=id)
|
177
|
-
return await Tournament.Schema.
|
177
|
+
return await Tournament.Schema.model.from_queryset_single(tournament)
|
178
178
|
except DoesNotExist:
|
179
179
|
raise HTTPException(status_code=404, detail="item not found")
|
180
180
|
|
@@ -280,7 +280,7 @@ router = APIRouter(prefix="/tournament", tags=["Tournament"])
|
|
280
280
|
@router.get("/")
|
281
281
|
async def list(user: auth.User = Depends(permissions.require_authenticated)):
|
282
282
|
queryset = Tournament.all()
|
283
|
-
return await Tournament.Schema.
|
283
|
+
return await Tournament.Schema.model.from_queryset(queryset)
|
284
284
|
|
285
285
|
|
286
286
|
...
|
@@ -322,7 +322,7 @@ router = APIRouter(prefix="/tournament", tags=["Tournament"])
|
|
322
322
|
@router.get("/teams")
|
323
323
|
async def teams(user: auth.User = Depends(permissions.require_authenticated)):
|
324
324
|
queryset = Team.for_user(user)
|
325
|
-
return await Tournament.Schema.
|
325
|
+
return await Tournament.Schema.model.from_queryset(queryset)
|
326
326
|
```
|
327
327
|
|
328
328
|
## Shell
|
@@ -135,14 +135,14 @@ router = APIRouter(prefix="/tournament", tags=['Tournament'])
|
|
135
135
|
@router.get("/")
|
136
136
|
async def list():
|
137
137
|
queryset = Tournament.all()
|
138
|
-
return await Tournament.Schema.
|
138
|
+
return await Tournament.Schema.model.from_queryset(queryset)
|
139
139
|
|
140
140
|
|
141
141
|
@router.get("/:id")
|
142
142
|
async def get(id: str):
|
143
143
|
try:
|
144
144
|
tournament = await Tournament.get(pk=id)
|
145
|
-
return await Tournament.Schema.
|
145
|
+
return await Tournament.Schema.model.from_queryset_single(tournament)
|
146
146
|
except DoesNotExist:
|
147
147
|
raise HTTPException(status_code=404, detail="item not found")
|
148
148
|
|
@@ -248,7 +248,7 @@ router = APIRouter(prefix="/tournament", tags=["Tournament"])
|
|
248
248
|
@router.get("/")
|
249
249
|
async def list(user: auth.User = Depends(permissions.require_authenticated)):
|
250
250
|
queryset = Tournament.all()
|
251
|
-
return await Tournament.Schema.
|
251
|
+
return await Tournament.Schema.model.from_queryset(queryset)
|
252
252
|
|
253
253
|
|
254
254
|
...
|
@@ -290,7 +290,7 @@ router = APIRouter(prefix="/tournament", tags=["Tournament"])
|
|
290
290
|
@router.get("/teams")
|
291
291
|
async def teams(user: auth.User = Depends(permissions.require_authenticated)):
|
292
292
|
queryset = Team.for_user(user)
|
293
|
-
return await Tournament.Schema.
|
293
|
+
return await Tournament.Schema.model.from_queryset(queryset)
|
294
294
|
```
|
295
295
|
|
296
296
|
## Shell
|
@@ -11,30 +11,18 @@ class ModelMeta(type(TortoiseModel)):
|
|
11
11
|
|
12
12
|
class BoundSchema:
|
13
13
|
@property
|
14
|
-
def
|
14
|
+
def model(self):
|
15
15
|
"""Return a Pydantic model class for 'one' results."""
|
16
16
|
include = getattr(schema_opts, "include", None)
|
17
17
|
exclude = getattr(schema_opts, "exclude", None)
|
18
18
|
return pydantic_model_creator(
|
19
19
|
new_cls,
|
20
|
-
name=f"{new_cls.__name__}
|
20
|
+
name=f"{new_cls.__name__}Schema",
|
21
21
|
include=include,
|
22
22
|
exclude=exclude,
|
23
23
|
exclude_readonly=True,
|
24
24
|
)
|
25
25
|
|
26
|
-
@property
|
27
|
-
def many(self):
|
28
|
-
"""Return a Pydantic queryset class for 'many' results."""
|
29
|
-
include = getattr(schema_opts, "include", None)
|
30
|
-
exclude = getattr(schema_opts, "exclude", None)
|
31
|
-
return pydantic_queryset_creator(
|
32
|
-
new_cls,
|
33
|
-
name=f"{new_cls.__name__}SchemaMany",
|
34
|
-
include=include,
|
35
|
-
exclude=exclude,
|
36
|
-
)
|
37
|
-
|
38
26
|
new_cls.Schema = BoundSchema()
|
39
27
|
return new_cls
|
40
28
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|