Skip to content

Instantly share code, notes, and snippets.

@DJWOMS
Created May 12, 2020 06:12
Show Gist options
  • Save DJWOMS/805c015c97f042038ebb6938371fc1fd to your computer and use it in GitHub Desktop.
Save DJWOMS/805c015c97f042038ebb6938371fc1fd to your computer and use it in GitHub Desktop.
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