Compare commits
No commits in common. "main" and "0.6.0" have entirely different histories.
5 changed files with 14 additions and 18 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "ohmyapi"
|
||||
version = "0.6.2"
|
||||
version = "0.6.0"
|
||||
description = "Django-flavored scaffolding and management layer around FastAPI, Pydantic, TortoiseORM and Aerich migrations"
|
||||
license = "MIT"
|
||||
keywords = ["fastapi", "tortoise", "orm", "pydantic", "async", "web-framework"]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
__VERSION__ = "0.6.2"
|
||||
__VERSION__ = "0.6.0"
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ class Claims(BaseModel):
|
|||
type: str
|
||||
sub: str
|
||||
user: ClaimsUser
|
||||
roles: List[str]
|
||||
exp: str
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -342,9 +342,9 @@ class App:
|
|||
except ModuleNotFoundError:
|
||||
return
|
||||
|
||||
installer = getattr(mod, "install", None)
|
||||
if installer is not None:
|
||||
for middleware in installer():
|
||||
getter = getattr(mod, "get", None)
|
||||
if getter is not None:
|
||||
for middleware in getter():
|
||||
self._middlewares.append(middleware)
|
||||
|
||||
def __serialize_route(self, route):
|
||||
|
|
@ -404,15 +404,10 @@ class App:
|
|||
"""
|
||||
Convenience method for serializing the runtime data.
|
||||
"""
|
||||
# An app may come without any models
|
||||
models = []
|
||||
if f"{self.name}.models" in self._models:
|
||||
models = [
|
||||
f"{self.name}.{m.__name__}"
|
||||
for m in self._models[f"{self.name}.models"]
|
||||
]
|
||||
return {
|
||||
"models": models,
|
||||
"models": [
|
||||
f"{self.name}.{m.__name__}" for m in self._models[f"{self.name}.models"]
|
||||
],
|
||||
"middlewares": self.__serialize_middleware(),
|
||||
"routes": self.__serialize_router(),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ CORS_CONFIG: Dict[str, Any] = getattr(settings, "MIDDLEWARE_CORS", {})
|
|||
if not isinstance(CORS_CONFIG, dict):
|
||||
raise ValueError("MIDDLEWARE_CORS must be of type dict")
|
||||
|
||||
middleware = (
|
||||
CORSMiddleware,
|
||||
{
|
||||
middleware = [
|
||||
(CORSMiddleware, {
|
||||
"allow_origins": CORS_CONFIG.get("ALLOW_ORIGINS", DEFAULT_ORIGINS),
|
||||
"allow_credentials": CORS_CONFIG.get("ALLOW_CREDENTIALS", DEFAULT_CREDENTIALS),
|
||||
"allow_methods": CORS_CONFIG.get("ALLOW_METHODS", DEFAULT_METHODS),
|
||||
"allow_headers": CORS_CONFIG.get("ALLOW_HEADERS", DEFAULT_HEADERS),
|
||||
}
|
||||
)
|
||||
}),
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue