Created
May 12, 2020 06:12
-
-
Save DJWOMS/805c015c97f042038ebb6938371fc1fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User(UserBase): | |
id: int | |
is_active: bool | |
class Config: | |
orm_mode = True | |
async def create_user(user: schemas.UserCreate): | |
fake_hashed_password = user.password + "notreallyhashed" | |
db_user = users.insert().values(email=user.email, hashed_password=fake_hashed_password) | |
return await database.execute(db_user) | |
@app.post("/users/", response_model=schemas.User) | |
async def create_user(user: schemas.UserCreate): | |
new_user = await create_user(user=user) | |
return {**new_user.dict(), "id": new_user} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment