mirror of
https://github.com/creyD/creyPY.git
synced 2026-04-13 03:40:31 +02:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f24db62781 |
@@ -36,7 +36,7 @@ def update_obj_from_data(
|
|||||||
model: Type[T],
|
model: Type[T],
|
||||||
id: UUID | str,
|
id: UUID | str,
|
||||||
db: Session,
|
db: Session,
|
||||||
partial: bool = False,
|
partial: bool = False, # TODO: inverse, because it is currently the wrong way around
|
||||||
ignore_fields=[],
|
ignore_fields=[],
|
||||||
additional_data={},
|
additional_data={},
|
||||||
exclude={},
|
exclude={},
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
from typing import Callable, Optional
|
from typing import Callable
|
||||||
|
|
||||||
|
from pydantic.json_schema import SkipJsonSchema
|
||||||
from sqlalchemy import asc, desc
|
from sqlalchemy import asc, desc
|
||||||
from sqlalchemy.sql.selectable import Select
|
from sqlalchemy.sql.selectable import Select
|
||||||
|
|
||||||
|
|
||||||
def order_by(order_by: Optional[str] = None) -> Callable[[Select], Select]:
|
def order_by(order_by: str | SkipJsonSchema[None] = None) -> Callable[[Select], Select]:
|
||||||
def _order_by(query: Select) -> Select:
|
def _order_by(query: Select) -> Select:
|
||||||
if order_by:
|
if order_by:
|
||||||
direction = desc if order_by.startswith("-") else asc
|
direction = desc if order_by.startswith("-") else asc
|
||||||
|
|||||||
Reference in New Issue
Block a user