ohmyapi 0.4.2__py3-none-any.whl → 0.4.4__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/__init__.py CHANGED
@@ -1 +1 @@
1
- __VERSION__ = "0.4.2"
1
+ __VERSION__ = "0.4.4"
ohmyapi/core/runtime.py CHANGED
@@ -129,7 +129,7 @@ class Project:
129
129
  }
130
130
 
131
131
  for app_name, app in self._apps.items():
132
- modules = list(app.models.keys())
132
+ modules = list(app._models.keys())
133
133
  if modules:
134
134
  config["apps"][app_name] = {
135
135
  "models": modules,
@@ -154,7 +154,10 @@ class Project:
154
154
  tortoise_cfg = self.build_tortoise_config(db_url=db_url)
155
155
 
156
156
  # Prevent leaking other app's models to Aerich.
157
- tortoise_cfg["apps"] = {app_label: tortoise_cfg["apps"][app_label]}
157
+ if app_label in tortoise_cfg["apps"].keys():
158
+ tortoise_cfg["apps"] = {app_label: tortoise_cfg["apps"][app_label]}
159
+ else:
160
+ tortoise_cfg["apps"] = {app_label: {"default_connection": "default", "models": []}}
158
161
 
159
162
  # Append aerich.models to the models list of the target app only
160
163
  tortoise_cfg["apps"][app_label]["models"].append("aerich.models")
@@ -372,9 +375,7 @@ class App:
372
375
  for module in self._models:
373
376
  for model in self._models[module]:
374
377
  out.append(model)
375
- return {
376
- module: out,
377
- }
378
+ return out
378
379
 
379
380
  @property
380
381
  def routers(self):
@@ -405,7 +406,7 @@ class App:
405
406
  """
406
407
  return {
407
408
  "models": [
408
- f"{self.name}.{m.__name__}" for m in self.models[f"{self.name}.models"]
409
+ f"{self.name}.{m.__name__}" for m in self._models[f"{self.name}.models"]
409
410
  ],
410
411
  "middlewares": self.__serialize_middleware(),
411
412
  "routes": self.__serialize_router(),
ohmyapi/db/__init__.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from tortoise.expressions import Q
2
2
  from tortoise.manager import Manager
3
+ from tortoise.query_utils import Prefetch
3
4
  from tortoise.queryset import QuerySet
4
5
  from tortoise.signals import (
5
6
  post_delete,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ohmyapi
3
- Version: 0.4.2
3
+ Version: 0.4.4
4
4
  Summary: Django-flavored scaffolding and management layer around FastAPI, Pydantic, TortoiseORM and Aerich migrations
5
5
  License-Expression: MIT
6
6
  Keywords: fastapi,tortoise,orm,pydantic,async,web-framework
@@ -1,4 +1,4 @@
1
- ohmyapi/__init__.py,sha256=t5wUp_k2esvkt_oNGmL48c_GliiH7gtMJuQG8WgOrvc,22
1
+ ohmyapi/__init__.py,sha256=mYI0a6jWLaNlCLiQdFp4oGaW2cuLjtAu-ogIcnh0E8w,22
2
2
  ohmyapi/__main__.py,sha256=wcCrL4PjG51r5wVKqJhcoJPTLfHW0wNbD31DrUN0MWI,28
3
3
  ohmyapi/builtin/auth/__init__.py,sha256=vOVCSJX8BALzs8h5ZW9507bjoscP37bncMjdMmBXcMM,42
4
4
  ohmyapi/builtin/auth/models.py,sha256=FJ-F7wY5tXBSZl5YZth6UzhBSFISVCZNc2gp2uKvmR0,2602
@@ -10,7 +10,7 @@ ohmyapi/builtin/demo/routes.py,sha256=1VTlEttrez6Qnhrz_9sTA-emtfXem0s0BkPVcLvg3k
10
10
  ohmyapi/cli.py,sha256=iWP0vPkodC_Y3MenNs9AH8FR_d-XpoXliGtz4inWkR4,5114
11
11
  ohmyapi/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  ohmyapi/core/logging.py,sha256=YHN-I2--WP1uXy4W3Q1aD1XLiG9-CrVWvyCYe8HsD9E,1094
13
- ohmyapi/core/runtime.py,sha256=AQuGvy_7owir-EQdc5RWELF0ETBN3eGpe93OoWWJ-aY,13686
13
+ ohmyapi/core/runtime.py,sha256=sXIlbRAzTvDzfJNB1COk0CHaUUfc-Vflmx6cVVoLRRg,13822
14
14
  ohmyapi/core/scaffolding.py,sha256=EehJesfDBB8vcMvc_T351QYdyJuyMGBA__BpLT33oVA,3122
15
15
  ohmyapi/core/templates/app/__init__.py.j2,sha256=QwVIQVUGZVhdH1d4NrvL7NTsK4-T4cihzYs8UVX2dt4,43
16
16
  ohmyapi/core/templates/app/models.py.j2,sha256=_3w-vFJ5fgsmncsCv34k_wyCMF78jufbSSglns4gbb0,119
@@ -20,13 +20,13 @@ ohmyapi/core/templates/docker/docker-compose.yml,sha256=GnFZN8hrxrIdpqQ2COMmBoFc
20
20
  ohmyapi/core/templates/project/README.md.j2,sha256=SjR4JIrg-8XRE-UntUDwiw8jDpYitD_UjwoKkYJ7GLw,22
21
21
  ohmyapi/core/templates/project/pyproject.toml.j2,sha256=xXMlZOZ4ewyE7Xlvk8kwyF1781-AZfG_CuNtXQGfxqk,522
22
22
  ohmyapi/core/templates/project/settings.py.j2,sha256=So6w1OiL_jU-FyeT8IHueDjGNuEoSkYhabhHpne2fUU,140
23
- ohmyapi/db/__init__.py,sha256=qoZZvji8wLwU38DSw9IcQOZm0C2sMF-fGn-b1J1fzws,239
23
+ ohmyapi/db/__init__.py,sha256=wMxq4C2tLh779IL5dl2HW4YBYomrLz12LGNk43VQQW8,281
24
24
  ohmyapi/db/exceptions.py,sha256=vb4IIUoeYAY6sK42zRtjMy-39IFVi_Qb6mWySTY0jYw,34
25
25
  ohmyapi/db/model/__init__.py,sha256=k3StTNuKatpwZo_Z5JBFa-927eJrzibFE8U4SA82asc,32
26
26
  ohmyapi/db/model/model.py,sha256=ui4g78c5xoS06Dj8Cdk7QgTjRnE68zKeL-AdmeYYPuQ,2776
27
27
  ohmyapi/middleware/cors.py,sha256=p8HlKsZLM6jKLEa2-q22cIEZUKawirMQB9ajfxaM4xw,818
28
28
  ohmyapi/router.py,sha256=5g0U59glu4hxxnIoTSFzb2S2offkOT3eE39aprzVxwo,83
29
- ohmyapi-0.4.2.dist-info/METADATA,sha256=_ITA42HF4CHXbttiaPEVrvEYWzbzPSaPrpWG3ww2HeE,2657
30
- ohmyapi-0.4.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
31
- ohmyapi-0.4.2.dist-info/entry_points.txt,sha256=wb3lw8-meAlpiv1mqcQ3m25ukL7djagU_w89GkrC37k,43
32
- ohmyapi-0.4.2.dist-info/RECORD,,
29
+ ohmyapi-0.4.4.dist-info/METADATA,sha256=CZM9d0hJTGW9xvEHmXenV3nz2n2OWhqRKy4GznoXBzs,2657
30
+ ohmyapi-0.4.4.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
31
+ ohmyapi-0.4.4.dist-info/entry_points.txt,sha256=wb3lw8-meAlpiv1mqcQ3m25ukL7djagU_w89GkrC37k,43
32
+ ohmyapi-0.4.4.dist-info/RECORD,,