Example #1
0
def update_user(bucket: Bucket, user_in: UserInUpdate, persist_to=0):
    user = update_user_in_db(bucket, user_in, persist_to=persist_to)
    user_in_sync_data = user.dict()
    user_in_sync_data.update({"name": user.username})
    if user_in.password:
        user_in_sync_data.update({"password": user_in.password})
    user_in_sync = UserSyncIn(**user_in_sync_data)
    assert update_sync_gateway_user(user_in_sync)
    return user
def upsert(bucket: Bucket, *, user_in: UserCreate, persist_to=0):
    user = upsert_in_db(bucket, user_in=user_in, persist_to=persist_to)
    user_in_sync = UserSyncIn(**user_in.dict(), name=user_in.username)
    assert insert_sync_gateway(user_in_sync)
    return user
Example #3
0
def upsert_user(bucket: Bucket, user_in: UserInCreate):
    user = upsert_user_in_db(bucket, user_in)
    user_in_sync = UserSyncIn(**user_in.json_dict())
    assert upsert_sync_gateway_user(user_in_sync)
    return user