fix: fix models
Build and Push Docker Image / build-and-push (push) Has been skipped
Details
Build and Push Docker Image / build-and-push (push) Has been skipped
Details
This commit is contained in:
parent
6a14e2d65c
commit
c2510fa9dc
|
|
@ -1,5 +1,7 @@
|
|||
"""Teleport History model."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from sqlalchemy import Column, DateTime, Float, ForeignKey, String, Text
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.sql import func
|
||||
|
|
@ -13,7 +15,11 @@ _LUCKPERMS_SCHEMA = APP_CONFIG.database.luckperms_schema
|
|||
|
||||
|
||||
class TeleportHistory(Base):
|
||||
"""Teleport History model."""
|
||||
"""Teleport History model.
|
||||
|
||||
This is an append-only audit log table, so it doesn't have updated_at column.
|
||||
We override updated_at to None to exclude it from this model.
|
||||
"""
|
||||
|
||||
__tablename__ = "hub_teleport_history"
|
||||
__table_args__ = {"schema": _HUB_SCHEMA}
|
||||
|
|
@ -35,8 +41,11 @@ class TeleportHistory(Base):
|
|||
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)
|
||||
tp_type = Column(String(50), nullable=False, index=True)
|
||||
target_name = Column(String(255))
|
||||
created_at = Column(
|
||||
DateTime(timezone=True), server_default=func.now(), nullable=False
|
||||
DateTime(timezone=True), server_default=func.now(), nullable=False, index=True
|
||||
)
|
||||
|
||||
# Override updated_at from Base to exclude it
|
||||
updated_at = None
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from uuid import UUID
|
|||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from hubgw.schemas.common import BaseSchema, PaginationParams
|
||||
from hubgw.schemas.common import PaginationParams
|
||||
|
||||
|
||||
class TeleportHistoryBase(BaseModel):
|
||||
|
|
@ -30,8 +30,11 @@ class TeleportHistoryCreate(TeleportHistoryBase):
|
|||
player_uuid: str
|
||||
|
||||
|
||||
class TeleportHistory(TeleportHistoryBase, BaseSchema):
|
||||
"""Teleport history schema."""
|
||||
class TeleportHistory(TeleportHistoryBase):
|
||||
"""Teleport history response schema.
|
||||
|
||||
This is an append-only audit log, so it only has created_at (no updated_at).
|
||||
"""
|
||||
|
||||
id: UUID
|
||||
player_uuid: str
|
||||
|
|
|
|||
Loading…
Reference in New Issue