예제 #1
0
def create_user(db_session: Session, *, user_in: UserCreate, otp: int) -> User:
    user = User(email=user_in.email,
                password_hash=get_password_hash(user_in.password),
                otp=otp)
    db_session.add(user)
    db_session.commit()
    db_session.refresh(user)
    return user
예제 #2
0
def create(db: Session, *, user_in: UserCreate) -> User:
    user = User(email=user_in.email,
                hashed_password=get_password_hash(user_in.password),
                full_name=user_in.full_name)
    db.add(user)
    db.commit()
    db.refresh(user)
    return user
예제 #3
0
def create(db_session: Session, *, user_in: UserCreate) -> User:
    user = User(email=user_in.email,
                hashed_password=user_in.hashed_password,
                role=user_in.role)

    db_session.add(user)
    db_session.commit()
    db_session.refresh(user)
    return user
예제 #4
0
 def create(self, db: Session) -> None:
     user = User(
         email=self.email,
         password_hash=get_password_hash(self.password),
         otp=self.otp,
     )
     db.add(user)
     db.commit()
     db.refresh(user)
     self.id = user.id
예제 #5
0
def create(db_session: Session, *, user_in: UserCreate) -> User:
    user = User(
        email=user_in.email,
        hashed_password=get_password_hash(user_in.password),
        full_name=user_in.full_name,
        is_superuser=user_in.is_superuser,
    )
    db_session.add(user)
    db_session.commit()
    db_session.refresh(user)
    return user
예제 #6
0
파일: user.py 프로젝트: jbham/law_dr
def create(db_session, *, user_in: UserInCreate) -> User:
    create_user_in_cognito(db_session,
                           user_to_create=user_in.email,
                           user_pool_id=None)
    user = User(email=user_in.email,
                hashed_password=get_password_hash(user_in.password),
                full_name=user_in.full_name,
                is_superuser=user_in.is_superuser,
                business_id=user_in.business_id,
                created_by=user_in.created_by,
                modified_by=user_in.modified_by,
                is_active=user_in.is_active)
    db_session.add(user)
    db_session.commit()
    db_session.refresh(user)
    return user
예제 #7
0
파일: user.py 프로젝트: BUsatov/offline-app
def create(db_session: Session, *, user_in: UserCreate) -> User:
    user_in_city = user_in.city.lower().strip()
    city = db_session.query(City).filter_by(name=user_in_city).first()
    if not city:
        city = City(name=user_in_city)
        db_session.add(city)
        db_session.commit()
        db_session.refresh(city)
    user = User(email=user_in.email,
                hashed_password=get_password_hash(user_in.password),
                full_name=user_in.full_name,
                city_id=city.id)
    db_session.add(user)
    db_session.commit()
    db_session.refresh(user)
    return user