Add password support to multiplayer rooms

Introduces a password field to the Room model and database schema, enabling password-protected multiplayer rooms. Adds LIO router endpoints for room creation, user join/leave, and updates related imports and router registrations.
This commit is contained in:
咕谷酱
2025-08-23 18:51:58 +08:00
committed by MingxuanGame
parent 5959254de6
commit e0aae80f4b
5 changed files with 342 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ class RoomBase(SQLModel, UTCBaseModel):
auto_start_duration: int
status: RoomStatus
channel_id: int | None = None
password: str | None = Field(default=None)
class Room(AsyncAttrs, RoomBase, table=True):
@@ -95,6 +96,7 @@ class RoomResp(RoomBase):
) -> "RoomResp":
d = room.model_dump()
d["channel_id"] = d.get("channel_id", 0) or 0
d["has_password"] = bool(room.password)
resp = cls.model_validate(d)
stats = RoomPlaylistItemStats(count_active=0, count_total=0)