create new user without passw., id in create_user
This commit is contained in:
parent
5012642f7a
commit
8c81935004
@ -180,8 +180,8 @@ def change_book_status(data: schemas.Book):
|
|||||||
@app.post("/api/signup")
|
@app.post("/api/signup")
|
||||||
def create_user(data = Body()):
|
def create_user(data = Body()):
|
||||||
if database.query(UserDatabase).filter(UserDatabase.email == data["email"]).first() == None:
|
if database.query(UserDatabase).filter(UserDatabase.email == data["email"]).first() == None:
|
||||||
new_user = UserDatabase(id=data["id"], email=data["email"], password=data["password"],
|
new_user = UserDatabase(email=data["email"], hashed_password=get_password_hash(data["password"]),
|
||||||
hashed_password=get_password_hash(data["password"]), name=data["name"], surname=data["surname"])
|
name=data["name"], surname=data["surname"])
|
||||||
database.add(new_user)
|
database.add(new_user)
|
||||||
database.commit()
|
database.commit()
|
||||||
database.refresh(new_user) # обновляем состояние объекта
|
database.refresh(new_user) # обновляем состояние объекта
|
||||||
|
Loading…
x
Reference in New Issue
Block a user