fix: explicit from_attributes config for nested schemas
Some checks failed
Deploy Fediversion / deploy (push) Failing after 1s
Some checks failed
Deploy Fediversion / deploy (push) Failing after 1s
This commit is contained in:
parent
c9d4266b77
commit
6b9d778b4d
2 changed files with 3 additions and 13 deletions
|
|
@ -109,19 +109,6 @@ def read_shows(
|
||||||
|
|
||||||
shows = session.exec(query.offset(offset).limit(limit)).all()
|
shows = session.exec(query.offset(offset).limit(limit)).all()
|
||||||
|
|
||||||
if shows:
|
|
||||||
print(f"DEBUG: Loaded {len(shows)} shows")
|
|
||||||
print(f"DEBUG: First show ID: {shows[0].id}")
|
|
||||||
print(f"DEBUG: First show Venue: {shows[0].venue}")
|
|
||||||
print(f"DEBUG: First show Vertical: {shows[0].vertical}")
|
|
||||||
try:
|
|
||||||
dump = ShowRead.model_validate(shows[0]).model_dump()
|
|
||||||
print(f"DEBUG: Serialized Dump: {dump}")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"DEBUG: Serialization Error: {e}")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return PaginatedResponse(
|
return PaginatedResponse(
|
||||||
data=shows,
|
data=shows,
|
||||||
meta=PaginationMeta(total=total, limit=limit, offset=offset)
|
meta=PaginationMeta(total=total, limit=limit, offset=offset)
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ class VenueCreate(VenueBase):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class VenueRead(VenueBase):
|
class VenueRead(VenueBase):
|
||||||
|
model_config = ConfigDict(from_attributes=True)
|
||||||
id: int
|
id: int
|
||||||
slug: Optional[str] = None
|
slug: Optional[str] = None
|
||||||
|
|
||||||
|
|
@ -97,6 +98,7 @@ class SongUpdate(SQLModel):
|
||||||
|
|
||||||
# --- Vertical Schema (simple for embedding) ---
|
# --- Vertical Schema (simple for embedding) ---
|
||||||
class VerticalSimple(SQLModel):
|
class VerticalSimple(SQLModel):
|
||||||
|
model_config = ConfigDict(from_attributes=True)
|
||||||
id: int
|
id: int
|
||||||
name: str
|
name: str
|
||||||
slug: str
|
slug: str
|
||||||
|
|
@ -226,6 +228,7 @@ class TourCreate(TourBase):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class TourRead(TourBase):
|
class TourRead(TourBase):
|
||||||
|
model_config = ConfigDict(from_attributes=True)
|
||||||
id: int
|
id: int
|
||||||
slug: Optional[str] = None
|
slug: Optional[str] = None
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue