def create_user(user: SchemaUser): db_user = ModelUser(first_name=user.first_name, last_name=user.last_name, age=user.age) db.session.add(db_user) db.session.commit() return db_user
def create_user(user: SchemaUser): db_user = ModelUser(user_email=user.user_email, name=user.name, verified=False, hash=secrets.token_hex(nbytes=16)) db.session.add(db_user) db.session.commit() return user
def create_user(user: SchemaUser): db_user = ModelUser(name=user.name, first_name=user.first_name, last_name=user.last_name, middle_name=user.middle_name) try: db.session.add(db_user) db.session.commit() except DatabaseError: db.session.rollback() raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="Невозможно создать клиента") return db_user