Chore: Updated fastapi and pydantic
Refactor: Removed mapped_column name string in models Refactor: Moved from postgres.uuid to uuid in models Fix: Schemas use Daf (Decimal as float to hack around pydantic v2 sending decimals as strings.)
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import JSON, Unicode, text
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy import JSON, Text, Uuid, text
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from ..db.base_class import reg
|
||||
@ -11,11 +10,9 @@ from ..db.base_class import reg
|
||||
class DbSetting:
|
||||
__tablename__ = "settings"
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(
|
||||
"id", UUID(as_uuid=True), primary_key=True, server_default=text("gen_random_uuid()"), insert_default=uuid.uuid4
|
||||
)
|
||||
name: Mapped[str] = mapped_column("name", Unicode(255), unique=True, nullable=False)
|
||||
data = mapped_column("data", JSON)
|
||||
id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, server_default=text("gen_random_uuid()"))
|
||||
name: Mapped[str] = mapped_column(Text, unique=True, nullable=False)
|
||||
data = mapped_column(JSON, nullable=False)
|
||||
|
||||
def __init__(self, id_=None, name=None, data=None):
|
||||
self.id = id_
|
||||
|
||||
Reference in New Issue
Block a user