mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-18 00:50:09 +03:00
fix: type User.username as str via Mapped-style column
mypy 2.4 (native parser by default) flags _jwt_username_var.set(user.username) in agent/mcp/__init__.py: with the legacy `username = Column(String)` declaration, instance access is typed Column[str], not str. Migrate the column to the Mapped/mapped_column style already used by token_version and last_login in the same table, with an explicit nullable=True so the schema stays identical to the former Column(String) declaration.
This commit is contained in:
parent
344a342924
commit
9887e3d5d7
@ -42,7 +42,9 @@ class User(BaseTable):
|
||||
__tablename__ = "users"
|
||||
|
||||
user_id = Column(GUID, primary_key=True, default=generate_uuid)
|
||||
username = Column(String, unique=True, index=True)
|
||||
# Mapped style so type checkers see `str` instead of `Column[str]`; the explicit
|
||||
# nullable=True keeps the schema identical to the former Column(String) declaration.
|
||||
username: Mapped[str] = mapped_column(String, unique=True, index=True, nullable=True)
|
||||
email = Column(String, unique=True, index=True)
|
||||
full_name = Column(String)
|
||||
hashed_password = Column(String)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user