Files
fastapi-best-architecture/backend/plugin/oauth2/model/user_social.py
T
Wu Clan a5e9a0e805 Refactor physical deletion to logical deletion (#1191)
* Refactor physical deletion to logical deletion

* Update the usage of unique indexes

* Update scheduler update and delete

* Fix lint

* Add some missing logic

* Optimize codegen get by id
2026-05-30 15:02:00 +08:00

24 lines
844 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import sqlalchemy as sa
from sqlalchemy.orm import Mapped, mapped_column
from backend.common.model import Base, id_key
class UserSocial(Base):
"""用户社交表(OAuth2)"""
__tablename__ = 'sys_user_social'
__table_args__ = (
sa.UniqueConstraint('user_id', 'source', 'deleted', name='uk_sys_user_social_user_id_source_deleted'),
sa.UniqueConstraint('sid', 'source', 'deleted', name='uk_sys_user_social_sid_source_deleted'),
{'comment': '用户社交表(OAuth2)'},
)
id: Mapped[id_key] = mapped_column(init=False)
sid: Mapped[str] = mapped_column(sa.String(256), comment='第三方用户 ID')
source: Mapped[str] = mapped_column(sa.String(32), comment='第三方用户来源')
# 逻辑外键
user_id: Mapped[int] = mapped_column(sa.BigInteger, comment='用户关联ID')