e329d3398a
Add FastAPI/React app with Docker deployment, Ubuntu one-click install, and docs for junior/senior high score tracking and mistake bank. Co-authored-by: Cursor <cursoragent@cursor.com>
24 lines
466 B
Python
24 lines
466 B
Python
from sqlalchemy.orm import Session
|
|
|
|
from app.models.user import Subject
|
|
|
|
DEFAULT_SUBJECTS = [
|
|
"语文",
|
|
"数学",
|
|
"英语",
|
|
"物理",
|
|
"化学",
|
|
"生物",
|
|
"历史",
|
|
"地理",
|
|
"政治",
|
|
]
|
|
|
|
|
|
def seed_subjects(db: Session) -> None:
|
|
existing = {s.name for s in db.query(Subject).all()}
|
|
for name in DEFAULT_SUBJECTS:
|
|
if name not in existing:
|
|
db.add(Subject(name=name))
|
|
db.commit()
|