b3227f5b78
- main_menu.gd: Play button now navigates to world_list.tscn
- world_list.gd: fix invalid theme_override_constants property-path syntax
(use add_theme_constant_override), fix @onready node paths missing
/HeaderHBox/, cast Variant dict values to String to avoid type-inference
errors when cards actually render
- world_list.tscn: wire up Back/Refresh button signal connections (scene
had zero [connection] blocks, buttons were dead)
- backend: fix real bug where World.visibility enum sent member names
("PUBLIC") to Postgres instead of lowercase values, breaking both GET
and POST /api/worlds/ for any real query
- backend: fix WorldResponse.created_at typed as str instead of datetime,
causing a second 500 on GET once the enum bug was fixed
- add smoke_test_world_list.gd: headless scene-level smoke test that
registers a user, instantiates the real scene, and confirms world cards
render from live backend data (not just an API-level check)
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey
|
|
from sqlalchemy.dialects.postgresql import ENUM
|
|
from sqlalchemy.orm import relationship
|
|
from sqlalchemy.sql import func
|
|
import enum
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class WorldVisibility(enum.Enum):
|
|
PUBLIC = "public"
|
|
PRIVATE = "private"
|
|
FRIENDS_ONLY = "friends_only"
|
|
|
|
|
|
class World(Base):
|
|
__tablename__ = "worlds"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String(255), nullable=False)
|
|
description = Column(Text, nullable=True)
|
|
owner_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
visibility = Column(
|
|
ENUM(
|
|
WorldVisibility,
|
|
name="world_visibility",
|
|
create_type=False,
|
|
values_callable=lambda enum_cls: [e.value for e in enum_cls],
|
|
),
|
|
default=WorldVisibility.PUBLIC,
|
|
)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
|
|
|
owner = relationship("User", back_populates="worlds")
|
|
assets = relationship("Asset", back_populates="world", cascade="all, delete-orphan")
|