Compare commits

..

3 Commits

Author SHA1 Message Date
renovate[bot]
79dde8008a feat(deps): update dependency stripe to v12 (#42)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-09 14:01:08 +02:00
creyD
adb017d6ce Adjusted files for isort & autopep 2025-04-09 12:01:00 +00:00
vikynoah
e160cc5fea feat: Response filter async (#47)
* fix: get_object alter for async response filter

* fix: Alter async response

* feat: Decorator for schema out
2025-04-09 14:00:30 +02:00
4 changed files with 21 additions and 2 deletions

View File

@@ -67,7 +67,6 @@ def get_object_or_404(
row = result.scalar_one_or_none()
if row is None:
raise HTTPException(status_code=404, detail="The object does not exist.")
obj_dict = row
if expunge:
await db.expunge(obj_dict)

View File

@@ -1,2 +1,3 @@
from .base import * # noqa
from .response_schema import * #noqa
from .schema_optional import * #noqa

View File

@@ -0,0 +1,19 @@
from typing import Optional, Type, Union, get_args, get_origin, get_type_hints
from pydantic import BaseModel, create_model
def optional_fields(cls: Type[BaseModel]) -> Type[BaseModel]:
fields = {}
for name, hint in get_type_hints(cls).items():
if name.startswith("_"):
continue
if get_origin(hint) is not Union or type(None) not in get_args(hint):
hint = Optional[hint]
fields[name] = (hint, None)
new_model = create_model(cls.__name__, __base__=cls, **fields)
return new_model

View File

@@ -1 +1 @@
stripe==11.6.0 # Stripe
stripe==12.0.0 # Stripe