ohmyapi 0.1.16__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.
Files changed (24) hide show
  1. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/PKG-INFO +5 -5
  2. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/README.md +4 -4
  3. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/pyproject.toml +1 -1
  4. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/core/scaffolding.py +1 -1
  5. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/db/model/model.py +2 -14
  6. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/__init__.py +0 -0
  7. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/__main__.py +0 -0
  8. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/builtin/auth/__init__.py +0 -0
  9. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/builtin/auth/models.py +0 -0
  10. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/builtin/auth/permissions.py +0 -0
  11. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/builtin/auth/routes.py +0 -0
  12. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/cli.py +0 -0
  13. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/core/__init__.py +0 -0
  14. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/core/runtime.py +0 -0
  15. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/core/templates/app/__init__.py.j2 +0 -0
  16. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/core/templates/app/models.py.j2 +0 -0
  17. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/core/templates/app/routes.py.j2 +0 -0
  18. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/core/templates/project/README.md.j2 +0 -0
  19. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/core/templates/project/pyproject.toml.j2 +0 -0
  20. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/core/templates/project/settings.py.j2 +0 -0
  21. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/db/__init__.py +0 -0
  22. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/db/exceptions.py +0 -0
  23. {ohmyapi-0.1.16 → ohmyapi-0.1.18}/src/ohmyapi/db/model/__init__.py +0 -0
  24. {ohmyapi-0.1.16 → 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.16
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.many.from_queryset(queryset)
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.one.form_orm(tournament)
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.many.from_queryset(queryset)
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.many.from_queryset(queryset)
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.many.from_queryset(queryset)
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.one.form_orm(tournament)
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.many.from_queryset(queryset)
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.many.from_queryset(queryset)
293
+ return await Tournament.Schema.model.from_queryset(queryset)
294
294
  ```
295
295
 
296
296
  ## Shell
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ohmyapi"
3
- version = "0.1.16"
3
+ version = "0.1.18"
4
4
  description = "A Django-like but async web-framework based on FastAPI and TortoiseORM."
5
5
  license = "MIT"
6
6
  keywords = ["fastapi", "tortoise", "orm", "async", "web-framework"]
@@ -53,7 +53,7 @@ def startproject(name: str):
53
53
  def startapp(name: str, project: str):
54
54
  """Create a new app inside a project: templates go into <project_dir>/<name>/"""
55
55
  target_dir = Path(project)
56
- target_dir.makedirs(exist_ok=True)
56
+ target_dir.mkdir(exist_ok=True)
57
57
  render_template_dir("app", target_dir, {"project_name": target_dir.resolve().name, "app_name": name}, subdir_name=name)
58
58
  print(f"✅ App '{name}' created in project '{target_dir}' successfully.")
59
59
  print(f"🔧 Remember to add '{name}' to your INSTALLED_APPS!")
@@ -11,30 +11,18 @@ class ModelMeta(type(TortoiseModel)):
11
11
 
12
12
  class BoundSchema:
13
13
  @property
14
- def one(self):
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__}SchemaOne",
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