Skip to content

Commit

Permalink
remove platform schema
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydzhou committed Jan 2, 2024
1 parent 42aa90a commit b2b6281
Showing 1 changed file with 9 additions and 34 deletions.
43 changes: 9 additions & 34 deletions server/model/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,13 @@ class Account(User):
class BindUser(Base):
__tablename__ = "bind_user"
user_id = db.Column(ObjID(12), ForeignKey("user.id"), nullable=True, comment="用户ID")
# 这里如果是飞书租户,可能会有不同的name等,但是在github这边不管是哪一个org,都是一样的
# 这里如何统一?
# 是不是说这里暂时不需要这个platform_id,还是说这个字段为空就好?
platform_id = db.Column(
ObjID(12), ForeignKey("im_platform.id"), nullable=True, comment="平台"
)
unionid = db.Column(db.String(128), nullable=True, comment="飞书的unionid")

# 这里还是用platform标记一下
platform = db.Column(db.String(128), nullable=True, comment="平台:github/lark")
# 实际关联的,可能是code_application.id或者im_application.id
application_id = db.Column(ObjID(12), nullable=True, comment="应用ID")
unionid = db.Column(db.String(128), nullable=True, comment="飞书的unionid")
openid = db.Column(db.String(128), nullable=True, comment="飞书的openid")

email = db.Column(db.String(128), nullable=True, comment="邮箱")
name = db.Column(db.String(128), nullable=True, comment="用户名")
avatar = db.Column(db.String(128), nullable=True, comment="头像")
Expand Down Expand Up @@ -174,20 +171,8 @@ class TeamMember(Base):
)


class CodePlatform(Base):
__tablename__ = "code_platform"
name = db.Column(db.String(128), nullable=True, comment="名称")
description = db.Column(db.String(1024), nullable=True, comment="描述")
extra = db.Column(
JSONStr(1024), nullable=True, server_default=text("'{}'"), comment="其他字段"
)


class Repo(Base):
__tablename__ = "repo"
code_platform_id = db.Column(
ObjID(12), ForeignKey("code_platform.id"), nullable=True, comment="属于哪一个org"
)
application_id = db.Column(
ObjID(12),
ForeignKey("code_application.id"),
Expand Down Expand Up @@ -217,20 +202,10 @@ class RepoUser(Base):
)


class IMPlatform(Base):
__tablename__ = "im_platform"
tenant_key = db.Column(db.String(128), nullable=True, comment="飞书租户id")
name = db.Column(db.String(128), nullable=True, comment="名称")
description = db.Column(db.String(1024), nullable=True, comment="描述")
extra = db.Column(
JSONStr(1024), nullable=True, server_default=text("'{}'"), comment="其他字段"
)


class CodeApplication(Base):
__tablename__ = "code_application"
platform_id = db.Column(
ObjID(12), ForeignKey("code_platform.id"), nullable=True, comment="代码平台"
team_id = db.Column(
ObjID(12), ForeignKey("team.id"), nullable=True, comment="属于哪一个组"
)
installation_id = db.Column(db.String(128), nullable=True, comment="安装id")
extra = db.Column(
Expand Down Expand Up @@ -267,8 +242,8 @@ class CodeAction(Base):

class IMApplication(Base):
__tablename__ = "im_application"
platform_id = db.Column(
ObjID(12), ForeignKey("code_platform.id"), nullable=True, comment="协同平台"
team_id = db.Column(
ObjID(12), ForeignKey("team.id"), nullable=True, comment="属于哪一个组"
)
app_id = db.Column(db.String(128), nullable=True, comment="app_id")
app_secret = db.Column(db.String(128), nullable=True, comment="app_id")
Expand Down

0 comments on commit b2b6281

Please sign in to comment.