diff --git a/src/hubgw/models/home.py b/src/hubgw/models/home.py index b1c0709..27b4532 100644 --- a/src/hubgw/models/home.py +++ b/src/hubgw/models/home.py @@ -1,6 +1,6 @@ """Home model.""" -from sqlalchemy import Column, Float, String, Boolean, ForeignKey, REAL +from sqlalchemy import Column, Float, String, Boolean, ForeignKey, REAL, Text from sqlalchemy.dialects.postgresql import UUID from hubgw.models.base import Base @@ -13,7 +13,7 @@ class Home(Base): id = Column(UUID(as_uuid=True), primary_key=True, server_default="gen_random_uuid()") player_uuid = Column(String(36), ForeignKey("luckperms_players.uuid", ondelete="CASCADE"), nullable=False, index=True) name = Column(String(255), nullable=False) - world = Column(String, nullable=False) # TEXT type + world = Column(Text, nullable=False) # TEXT type x = Column(Float, nullable=False) # DOUBLE PRECISION y = Column(Float, nullable=False) # DOUBLE PRECISION z = Column(Float, nullable=False) # DOUBLE PRECISION diff --git a/src/hubgw/models/teleport_history.py b/src/hubgw/models/teleport_history.py index 0e01dbb..cf35012 100644 --- a/src/hubgw/models/teleport_history.py +++ b/src/hubgw/models/teleport_history.py @@ -1,7 +1,8 @@ """Teleport History model.""" -from sqlalchemy import Column, String, Float, ForeignKey +from sqlalchemy import Column, String, Float, ForeignKey, Text, DateTime from sqlalchemy.dialects.postgresql import UUID +from sqlalchemy.sql import func from hubgw.models.base import Base @@ -12,13 +13,14 @@ class TeleportHistory(Base): id = Column(UUID(as_uuid=True), primary_key=True, server_default="gen_random_uuid()") player_uuid = Column(String(36), ForeignKey("luckperms_players.uuid", ondelete="CASCADE"), nullable=False, index=True) - from_world = Column(String) - from_x = Column(Float) - from_y = Column(Float) - from_z = Column(Float) - to_world = Column(String, nullable=False) - to_x = Column(Float, nullable=False) - to_y = Column(Float, nullable=False) - to_z = Column(Float, nullable=False) + from_world = Column(Text) + from_x = Column(Float) # DOUBLE PRECISION + from_y = Column(Float) # DOUBLE PRECISION + from_z = Column(Float) # DOUBLE PRECISION + to_world = Column(Text, nullable=False) + to_x = Column(Float, nullable=False) # DOUBLE PRECISION + to_y = Column(Float, nullable=False) # DOUBLE PRECISION + to_z = Column(Float, nullable=False) # DOUBLE PRECISION tp_type = Column(String(50), nullable=False) - target_name = Column(String(255)) \ No newline at end of file + target_name = Column(String(255)) + created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False) \ No newline at end of file diff --git a/src/hubgw/models/warp.py b/src/hubgw/models/warp.py index ae2619a..ebae409 100644 --- a/src/hubgw/models/warp.py +++ b/src/hubgw/models/warp.py @@ -1,6 +1,6 @@ """Warp model.""" -from sqlalchemy import Column, String, Float, Boolean, REAL +from sqlalchemy import Column, String, Float, Boolean, REAL, Text from sqlalchemy.dialects.postgresql import UUID from hubgw.models.base import Base @@ -12,7 +12,7 @@ class Warp(Base): id = Column(UUID(as_uuid=True), primary_key=True, server_default="gen_random_uuid()") name = Column(String(255), nullable=False, unique=True, index=True) - world = Column(String, nullable=False) # TEXT type + world = Column(Text, nullable=False) # TEXT type x = Column(Float, nullable=False) # DOUBLE PRECISION y = Column(Float, nullable=False) # DOUBLE PRECISION z = Column(Float, nullable=False) # DOUBLE PRECISION diff --git a/src/hubgw/schemas/teleport_history.py b/src/hubgw/schemas/teleport_history.py index 4b4bc10..1f64983 100644 --- a/src/hubgw/schemas/teleport_history.py +++ b/src/hubgw/schemas/teleport_history.py @@ -32,4 +32,5 @@ class TeleportHistory(TeleportHistoryBase, BaseSchema): """Teleport history schema.""" id: UUID - player_uuid: str \ No newline at end of file + player_uuid: str + created_at: datetime \ No newline at end of file diff --git a/src/hubgw/services/teleport_history_service.py b/src/hubgw/services/teleport_history_service.py index 3bc1024..559ee01 100644 --- a/src/hubgw/services/teleport_history_service.py +++ b/src/hubgw/services/teleport_history_service.py @@ -29,8 +29,7 @@ class TeleportHistoryService: to_z=entry.to_z, tp_type=entry.tp_type, target_name=entry.target_name, - created_at=entry.created_at, - updated_at=entry.updated_at + created_at=entry.created_at ) async def list_player_teleports(self, player_uuid: str, limit: int = 100) -> List[TeleportHistory]: @@ -50,8 +49,7 @@ class TeleportHistoryService: to_z=entry.to_z, tp_type=entry.tp_type, target_name=entry.target_name, - created_at=entry.created_at, - updated_at=entry.updated_at + created_at=entry.created_at ) for entry in entries ] \ No newline at end of file