def propose_update_manager(self, key, proposal_id, user_id, new_manager_id,
                               reason, metadata):

        batch_list, signature = manager_transaction_creation.propose_manager(
            txn_key=key,
            batch_key=self._key,
            proposal_id=proposal_id,
            user_id=user_id,
            new_manager_id=new_manager_id,
            reason=reason,
            metadata=metadata,
        )
        self._client.send_batches(batch_list)
        return self._client.get_statuses([signature], wait=10)
Example #2
0
async def update_manager(request, user_id):
    required_fields = ["id"]
    utils.validate_fields(required_fields, request.json)

    txn_key = await utils.get_transactor_key(request)
    proposal_id = str(uuid4())
    batch_list, _ = propose_manager(
        txn_key=txn_key,
        batch_key=request.app.config.BATCHER_KEY_PAIR,
        proposal_id=proposal_id,
        user_id=user_id,
        new_manager_id=request.json.get("id"),
        reason=request.json.get("reason"),
        metadata=request.json.get("metadata"),
    )
    await utils.send(request.app.config.VAL_CONN, batch_list,
                     request.app.config.TIMEOUT)
    return json({"proposal_id": proposal_id})