fastapi-mongo-base 0.9.4__tar.gz → 0.9.6__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.
- {fastapi_mongo_base-0.9.4/src/fastapi_mongo_base.egg-info → fastapi_mongo_base-0.9.6}/PKG-INFO +1 -1
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/pyproject.toml +1 -1
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/core/app_factory.py +14 -13
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/core/middlewares.py +3 -5
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/routes.py +1 -1
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6/src/fastapi_mongo_base.egg-info}/PKG-INFO +1 -1
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/LICENSE.txt +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/README.md +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/setup.cfg +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/__init__.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/cached.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/core/__init__.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/core/config.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/core/db.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/core/enums.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/core/exceptions.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/handlers.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/models.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/schemas.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/tasks.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/utils/__init__.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/utils/aionetwork.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/utils/basic.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/utils/bsontools.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/utils/imagetools.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/utils/texttools.py +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base.egg-info/SOURCES.txt +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base.egg-info/dependency_links.txt +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base.egg-info/requires.txt +0 -0
- {fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base.egg-info/top_level.txt +0 -0
{fastapi_mongo_base-0.9.4/src/fastapi_mongo_base.egg-info → fastapi_mongo_base-0.9.6}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: fastapi-mongo-base
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.6
|
|
4
4
|
Summary: A simple boilerplate application, including models and schemas and abstract router, for FastAPI with MongoDB
|
|
5
5
|
Author-email: Mahdi Kiani <mahdikiany@gmail.com>
|
|
6
6
|
Maintainer-email: Mahdi Kiani <mahdikiany@gmail.com>
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "fastapi-mongo-base"
|
|
7
|
-
version = "0.9.
|
|
7
|
+
version = "0.9.6"
|
|
8
8
|
description = "A simple boilerplate application, including models and schemas and abstract router, for FastAPI with MongoDB"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
{fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/core/app_factory.py
RENAMED
|
@@ -15,6 +15,19 @@ except ImportError:
|
|
|
15
15
|
from .config import Settings
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
async def health(request: fastapi.Request):
|
|
19
|
+
return {
|
|
20
|
+
"status": "up",
|
|
21
|
+
"host": request.url.hostname,
|
|
22
|
+
# "project_name": settings.project_name,
|
|
23
|
+
# "host2": request.base_url.hostname,
|
|
24
|
+
# "original_host":request.headers.get("x-original-host", "!not found!"),
|
|
25
|
+
# "forwarded_host": request.headers.get("X-Forwarded-Host", "forwarded_host"),
|
|
26
|
+
# "forwarded_proto": request.headers.get("X-Forwarded-Proto", "forwarded_proto"),
|
|
27
|
+
# "forwarded_for": request.headers.get("X-Forwarded-For", "forwarded_for"),
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
18
31
|
@asynccontextmanager
|
|
19
32
|
async def lifespan(app: fastapi.FastAPI, worker=None, init_functions=[], settings: Settings = None): # type: ignore
|
|
20
33
|
"""Initialize application services."""
|
|
@@ -160,18 +173,6 @@ def create_app(
|
|
|
160
173
|
**kwargs,
|
|
161
174
|
)
|
|
162
175
|
|
|
163
|
-
async def health(request: fastapi.Request):
|
|
164
|
-
return {
|
|
165
|
-
"status": "up",
|
|
166
|
-
"host": request.url.hostname,
|
|
167
|
-
"project_name": settings.project_name,
|
|
168
|
-
# "host2": request.base_url.hostname,
|
|
169
|
-
# "original_host":request.headers.get("x-original-host", "!not found!"),
|
|
170
|
-
# "forwarded_host": request.headers.get("X-Forwarded-Host", "forwarded_host"),
|
|
171
|
-
# "forwarded_proto": request.headers.get("X-Forwarded-Proto", "forwarded_proto"),
|
|
172
|
-
# "forwarded_for": request.headers.get("X-Forwarded-For", "forwarded_for"),
|
|
173
|
-
}
|
|
174
|
-
|
|
175
176
|
async def logs():
|
|
176
177
|
with open(settings.get_log_config()["info_log_path"], "rb") as f:
|
|
177
178
|
last_100_lines = deque(f, maxlen=100)
|
|
@@ -179,7 +180,7 @@ def create_app(
|
|
|
179
180
|
return [line.decode("utf-8") for line in last_100_lines]
|
|
180
181
|
|
|
181
182
|
app.get(f"{base_path}/health")(health)
|
|
182
|
-
if log_route:
|
|
183
|
+
if log_route:
|
|
183
184
|
app.get(f"{base_path}/logs", include_in_schema=False)(logs)
|
|
184
185
|
|
|
185
186
|
if serve_coverage:
|
{fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/core/middlewares.py
RENAMED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import fastapi
|
|
2
|
-
from fastapi.responses import PlainTextResponse
|
|
3
|
-
from starlette.middleware.base import BaseHTTPMiddleware
|
|
4
|
-
|
|
5
1
|
import logging
|
|
6
2
|
|
|
3
|
+
import fastapi
|
|
7
4
|
from fastapi import Request
|
|
5
|
+
from fastapi.responses import PlainTextResponse
|
|
8
6
|
from starlette.middleware.base import BaseHTTPMiddleware
|
|
9
7
|
|
|
10
8
|
|
|
@@ -27,7 +25,7 @@ class RequestLoggingMiddleware(BaseHTTPMiddleware):
|
|
|
27
25
|
|
|
28
26
|
|
|
29
27
|
class DynamicCORSMiddleware(BaseHTTPMiddleware):
|
|
30
|
-
|
|
28
|
+
|
|
31
29
|
async def get_allowed_origins(self, origin, **kwargs):
|
|
32
30
|
from ufaas_fastapi_business.models import Business
|
|
33
31
|
|
|
@@ -151,7 +151,7 @@ class AbstractBaseRouter(Generic[T, TS], metaclass=singleton.Singleton):
|
|
|
151
151
|
limit: int = 10,
|
|
152
152
|
**kwargs,
|
|
153
153
|
):
|
|
154
|
-
user_id = await self.get_user_id(request)
|
|
154
|
+
user_id = kwargs.pop("user_id", await self.get_user_id(request))
|
|
155
155
|
limit = max(1, min(limit, Settings.page_max_limit))
|
|
156
156
|
|
|
157
157
|
items, total = await self.model.list_total_combined(
|
{fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6/src/fastapi_mongo_base.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: fastapi-mongo-base
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.6
|
|
4
4
|
Summary: A simple boilerplate application, including models and schemas and abstract router, for FastAPI with MongoDB
|
|
5
5
|
Author-email: Mahdi Kiani <mahdikiany@gmail.com>
|
|
6
6
|
Maintainer-email: Mahdi Kiani <mahdikiany@gmail.com>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/core/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/core/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/utils/__init__.py
RENAMED
|
File without changes
|
{fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/utils/aionetwork.py
RENAMED
|
File without changes
|
|
File without changes
|
{fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/utils/bsontools.py
RENAMED
|
File without changes
|
{fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/utils/imagetools.py
RENAMED
|
File without changes
|
{fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base/utils/texttools.py
RENAMED
|
File without changes
|
{fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base.egg-info/requires.txt
RENAMED
|
File without changes
|
{fastapi_mongo_base-0.9.4 → fastapi_mongo_base-0.9.6}/src/fastapi_mongo_base.egg-info/top_level.txt
RENAMED
|
File without changes
|