fix 用户调整为使用名称做主键

add 插件API
This commit is contained in:
jxxghp
2023-06-19 17:04:10 +08:00
parent df0ba221f9
commit c7f897fdcd
11 changed files with 152 additions and 35 deletions

View File

@ -23,11 +23,10 @@ def init_db():
Base.metadata.create_all(bind=Engine)
# 初始化超级管理员
_db = SessionLocal()
user = User.get_by_email(db=_db, email=settings.SUPERUSER)
user = User.get_by_name(db=_db, name=settings.SUPERUSER)
if not user:
user = User(
full_name="Admin",
email=settings.SUPERUSER,
name=settings.SUPERUSER,
hashed_password=get_password_hash(settings.SUPERUSER_PASSWORD),
is_superuser=True,
)