Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| acbc518b4a |
@@ -69,7 +69,8 @@ def upgrade() -> None:
|
||||
sa.Column(
|
||||
"visibility",
|
||||
postgresql.ENUM(
|
||||
"public", "private", "friends_only", name="world_visibility"
|
||||
"public", "private", "friends_only", name="world_visibility",
|
||||
create_type=False,
|
||||
),
|
||||
nullable=True,
|
||||
),
|
||||
@@ -89,7 +90,7 @@ def upgrade() -> None:
|
||||
"asset_type",
|
||||
postgresql.ENUM(
|
||||
"image", "audio", "video", "document", "model_3d", "other",
|
||||
name="asset_type",
|
||||
name="asset_type", create_type=False,
|
||||
),
|
||||
nullable=False,
|
||||
),
|
||||
|
||||
@@ -3,10 +3,6 @@ from sqlalchemy.dialects.postgresql import ENUM
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.sql import func
|
||||
import enum
|
||||
import json
|
||||
from typing import Optional, List
|
||||
|
||||
from pydantic import BaseModel as PydanticBaseModel
|
||||
|
||||
from app.database import Base
|
||||
|
||||
@@ -42,31 +38,3 @@ class Asset(Base):
|
||||
|
||||
owner = relationship("User", back_populates="assets")
|
||||
world = relationship("World", back_populates="assets")
|
||||
|
||||
|
||||
class GLTFMetadata(PydanticBaseModel):
|
||||
"""Pydantic schema for glTF asset metadata."""
|
||||
mesh_count: Optional[int] = None
|
||||
vertex_count: Optional[int] = None
|
||||
has_animation: bool = False
|
||||
texture_refs: Optional[List[str]] = None
|
||||
tags: Optional[List[str]] = None
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
def parse_metadata_json(metadata_text: Optional[str]) -> dict:
|
||||
"""Parse the metadata_json text field into a dict, handling None gracefully."""
|
||||
if not metadata_text:
|
||||
return {}
|
||||
try:
|
||||
return json.loads(metadata_text)
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
return {}
|
||||
|
||||
|
||||
def serialize_metadata(metadata: dict) -> Optional[str]:
|
||||
"""Serialize metadata dict to JSON string for storage."""
|
||||
if not metadata:
|
||||
return None
|
||||
return json.dumps(metadata)
|
||||
|
||||
@@ -8,7 +8,7 @@ services:
|
||||
POSTGRES_PASSWORD: agp_password
|
||||
POSTGRES_DB: agp_db
|
||||
ports:
|
||||
- "5432:5432"
|
||||
- "${POSTGRES_HOST_PORT:-5432}:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
@@ -20,7 +20,7 @@ services:
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
ports:
|
||||
- "6379:6379"
|
||||
- "${REDIS_HOST_PORT:-6379}:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
|
||||
Reference in New Issue
Block a user