Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #618 from SELab-2/development
Browse files Browse the repository at this point in the history
merge dev into main
  • Loading branch information
Jarne-Andries authored May 22, 2022
2 parents 82dec6b + 5cd57ce commit ea8ba47
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions backend/app/routers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from app.crud import count_where, read_where, update
from app.database import db, get_session
from app.exceptions.user_exceptions import InvalidEmailOrPasswordException
from app.models.edition import Edition
from app.models.passwordreset import EmailInput
from app.models.tokens import TokenExtended
from app.models.user import User, UserLogin, UserRole
Expand All @@ -22,6 +23,9 @@
from fastapi_jwt_auth import AuthJWT
from pydantic import BaseModel
from sqlalchemy.ext.asyncio import AsyncSession
import datetime
from app.models.question import Question
from app.models.question_tag import QuestionTag

oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
load_dotenv()
Expand Down Expand Up @@ -117,6 +121,15 @@ async def login(user: UserLogin, Authorize: AuthJWT = Depends(), session: AsyncS
approved=True,
disabled=False)
u = await update(new_user, session)
year = datetime.date.today().year
# make the first edition
new_edition = await update(Edition(year=year, name="my first edition"), session=session)
for mand_tag in ["first name", "last name", "email", "alumni", "student-coach", "skills"]:
new_q = Question(edition=new_edition.year, question="please configure the question fot the tag '" + mand_tag + "'.")
await update(new_q, session=session)
new_qt = QuestionTag(edition=new_edition.year, tag=mand_tag, question=new_q, mandatory=True, show_in_list=False)
await update(new_qt, session=session)

else:
u = await read_where(User,
User.email == user.email, User.disabled == False, User.active == True,
Expand Down

0 comments on commit ea8ba47

Please sign in to comment.