示例#1
0
 def create(self, db_session: Session, *, obj_in: UserCreate) -> User:
     db_obj = User(
         **obj_in.dict(exclude={"password"}),
         password=get_password_hash(obj_in.password),
     )
     db_session.add(db_obj)
     db_session.commit()
     db_session.refresh(db_obj)
     return db_obj
示例#2
0
async def resolve_user_create(parent, info, user) -> dict:
    store_data = User.get_instance()
    data = UserCreate(**user)
    normalize = change_keys(data.dict(exclude_none=True), key="_key")

    return await store_data.create(normalize)