Skip to content

Conversation

@dechdev
Copy link
Contributor

@dechdev dechdev commented Mar 23, 2022

GET /events?fetchreferences now returns enriched events for all event types:

type EnrichedEvent struct {
	Event
	BlockchainEvent   *BlockchainEvent `json:"blockchainevent,omitempty"`
	ContractAPI       *ContractAPI     `json:"contractAPI,omitempty"`
	ContractInterface *FFI             `json:"contractInterface,omitempty"`
	Datatype          *Datatype        `json:"datatype,omitempty"`
	Identity          *Identity        `json:"identity,omitempty"`
	Message           *Message         `json:"message,omitempty"`
	NamespaceDetails  *Namespace       `json:"namespaceDetails,omitempty"`
	TokenApproval     *TokenApproval   `json:"tokenApproval,omitempty"`
	TokenPool         *TokenPool       `json:"tokenPool,omitempty"`
	Transaction       *Transaction     `json:"transaction,omitempty"`
	TokenTransfer     *TokenTransfer   `json:"tokenTransfer,omitempty"`
}

Signed-off-by: David Echelberger <eberger727@gmail.com>
@codecov-commenter
Copy link

Codecov Report

Merging #623 (10af7cd) into main (992ed8a) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #623   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          311       311           
  Lines        18784     18845   +61     
=========================================
+ Hits         18784     18845   +61     
Impacted Files Coverage Δ
pkg/fftypes/event.go 100.00% <ø> (ø)
internal/database/sqlcommon/namespace_sql.go 100.00% <100.00%> (ø)
internal/txcommon/event_enrich.go 100.00% <100.00%> (ø)
internal/orchestrator/orchestrator.go 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 992ed8a...10af7cd. Read the comment docs.

return namespace, nil
}

func (s *SQLCommon) GetNamespaceByID(ctx context.Context, id *fftypes.UUID) (ns *fftypes.Namespace, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we follow the pattern here and remove a lot of the code/test duplication?

func (s *SQLCommon) GetDatatypeByID(ctx context.Context, id *fftypes.UUID) (message *fftypes.Datatype, err error) {
return s.getDatatypeEq(ctx, sq.Eq{"id": id}, id.String())
}
func (s *SQLCommon) GetDatatypeByName(ctx context.Context, ns, name, version string) (message *fftypes.Datatype, err error) {
return s.getDatatypeEq(ctx, sq.Eq{"namespace": ns, "name": name, "version": version}, fmt.Sprintf("%s:%s", ns, name))
}

Copy link
Contributor

@peterbroadhurst peterbroadhurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!
One request to remove a bit of duplication before this goes in @eberger727

Signed-off-by: David Echelberger <eberger727@gmail.com>
Transaction *Transaction `json:"transaction,omitempty"`
BlockchainEvent *BlockchainEvent `json:"blockchainevent,omitempty"`
BlockchainEvent *BlockchainEvent `json:"blockchainevent,omitempty"`
ContractAPI *ContractAPI `json:"contractAPI,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed that the API here is /api/v1/namespaces/{ns}/apis, but felt it was clearer to include contractAPI rather than just api here

Datatype *Datatype `json:"datatype,omitempty"`
Identity *Identity `json:"identity,omitempty"`
Message *Message `json:"message,omitempty"`
NamespaceDetails *Namespace `json:"namespaceDetails,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this cannot follow the pattern and just be namespace, because that is already just the string name of the namespace.

@peterbroadhurst peterbroadhurst merged commit d6c92a3 into hyperledger:main Mar 23, 2022
@peterbroadhurst peterbroadhurst deleted the fetchreferences2 branch March 23, 2022 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants