multinode/operators: operator entity extended with nodeID and undistributed amount
Change-Id: I423fe79b0aefe09d0b0ddab490d7a39e2b3f3249
This commit is contained in:
parent
be16f4b68b
commit
b445e7d397
@ -3,11 +3,17 @@
|
||||
|
||||
package operators
|
||||
|
||||
// Operator contains contains SNO payouts contact details.
|
||||
import (
|
||||
"storj.io/common/storj"
|
||||
)
|
||||
|
||||
// Operator contains contains SNO payouts contact details and amount of undistributed payouts.
|
||||
type Operator struct {
|
||||
Email string `json:"email"`
|
||||
Wallet string `json:"wallet"`
|
||||
WalletFeatures []string `json:"walletFeatures"`
|
||||
NodeID storj.NodeID `json:"nodeId"`
|
||||
Email string `json:"email"`
|
||||
Wallet string `json:"wallet"`
|
||||
WalletFeatures []string `json:"walletFeatures"`
|
||||
Undistributed int64 `json:"undistributed"`
|
||||
}
|
||||
|
||||
// Cursor holds operator cursor entity which is used to create listed page.
|
||||
|
@ -101,17 +101,25 @@ func (service *Service) GetOperator(ctx context.Context, node nodes.Node) (_ Ope
|
||||
}()
|
||||
|
||||
nodeClient := multinodepb.NewDRPCNodeClient(conn)
|
||||
payoutClient := multinodepb.NewDRPCPayoutsClient(conn)
|
||||
header := &multinodepb.RequestHeader{
|
||||
ApiKey: node.APISecret,
|
||||
}
|
||||
resp, err := nodeClient.Operator(ctx, &multinodepb.OperatorRequest{Header: header})
|
||||
|
||||
operatorResponse, err := nodeClient.Operator(ctx, &multinodepb.OperatorRequest{Header: header})
|
||||
if err != nil {
|
||||
return Operator{}, Error.Wrap(err)
|
||||
}
|
||||
undistributedResponse, err := payoutClient.Undistributed(ctx, &multinodepb.UndistributedRequest{Header: header})
|
||||
if err != nil {
|
||||
return Operator{}, Error.Wrap(err)
|
||||
}
|
||||
|
||||
return Operator{
|
||||
Email: resp.Email,
|
||||
Wallet: resp.Wallet,
|
||||
WalletFeatures: resp.WalletFeatures,
|
||||
NodeID: node.ID,
|
||||
Email: operatorResponse.Email,
|
||||
Wallet: operatorResponse.Wallet,
|
||||
WalletFeatures: operatorResponse.WalletFeatures,
|
||||
Undistributed: undistributedResponse.Total,
|
||||
}, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user