ohmyapi 0.1.17__py3-none-any.whl → 0.1.18__py3-none-any.whl
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/db/model/model.py +2 -14
- {ohmyapi-0.1.17.dist-info → ohmyapi-0.1.18.dist-info}/METADATA +5 -5
- {ohmyapi-0.1.17.dist-info → ohmyapi-0.1.18.dist-info}/RECORD +5 -5
- {ohmyapi-0.1.17.dist-info → ohmyapi-0.1.18.dist-info}/WHEEL +0 -0
- {ohmyapi-0.1.17.dist-info → ohmyapi-0.1.18.dist-info}/entry_points.txt +0 -0
ohmyapi/db/model/model.py
CHANGED
@@ -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
|
|
@@ -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
|
@@ -17,9 +17,9 @@ ohmyapi/core/templates/project/settings.py.j2,sha256=RBKGB8MZWPM3Bp0a57Y1YrSvSXx
|
|
17
17
|
ohmyapi/db/__init__.py,sha256=T7AUWlEXD--WOn01mKPIpkxPVwmgYHZQ4vQo3ejOkgE,204
|
18
18
|
ohmyapi/db/exceptions.py,sha256=I7AubrdqQF_UvAvzKqz2ve08-BkXHzEWXnwG300StHE,35
|
19
19
|
ohmyapi/db/model/__init__.py,sha256=k3StTNuKatpwZo_Z5JBFa-927eJrzibFE8U4SA82asc,32
|
20
|
-
ohmyapi/db/model/model.py,sha256=
|
20
|
+
ohmyapi/db/model/model.py,sha256=6Qzra6YaUCEPjw6hl5chfMUfIt-IRZbkNTrQvWOQ_TI,1095
|
21
21
|
ohmyapi/router.py,sha256=hutccsrP9RT8W5O6uBDhOJehwqrkRoPzaUI5zoHPh9A,55
|
22
|
-
ohmyapi-0.1.
|
23
|
-
ohmyapi-0.1.
|
24
|
-
ohmyapi-0.1.
|
25
|
-
ohmyapi-0.1.
|
22
|
+
ohmyapi-0.1.18.dist-info/METADATA,sha256=_MZsyVUH8n0KeHJq_b-92mXZoPVt-q2LG6__mHjM71U,8783
|
23
|
+
ohmyapi-0.1.18.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88
|
24
|
+
ohmyapi-0.1.18.dist-info/entry_points.txt,sha256=wb3lw8-meAlpiv1mqcQ3m25ukL7djagU_w89GkrC37k,43
|
25
|
+
ohmyapi-0.1.18.dist-info/RECORD,,
|
File without changes
|
File without changes
|