Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
Add actor as an optional attribute for now
Browse files Browse the repository at this point in the history
It should be mandatory, but that will come later when we are ready to
rewrite all the test data.

Signed-off-by: Niels Thykier <[email protected]>
  • Loading branch information
nt-gt committed Jun 9, 2023
1 parent 6bf1b1f commit acc9c79
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions datamodel/initdb.d/03_ec_registry.sql
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ CREATE TABLE ec_registry."transaction" (
platform_host varchar(255) NULL,
"timestamp" int8 NOT NULL,
transferee varchar(255) NULL,
actor varchar(255) NULL,
envelope_hash varchar(64) NULL,
CONSTRAINT uniquetimestampanddocumenthash UNIQUE ("timestamp", document_hash)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ public class Transaction {
@JoinColumn(name = "transferee")
private Party party;

@ToString.Exclude
@EqualsAndHashCode.Exclude
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "actor")
private Party actor;

public Transaction linkTransactionToTransportDocument(TransportDocument transportDocument) {
if (Boolean.TRUE.equals(transportDocument.getIsExported())) {
throw ConcreteRequestErrorMessageException.internalServerError("Cannot link a transaction to an exported transportDocument");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ EndorsementChainEntry signedEndorsementEntryToEndorsementChainEntry(
.build()
);

// FIXME: we should only resolve the latest transferee.
var transactions =
endorsementChainEntryTO.transactions().stream()
.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public EndorsementChainTransactionTO endorsementChainTransactionTO() {
.platformHost("localhost:8443")
.timestamp(System.currentTimeMillis())
.transferee("Transferee@localhost:8443")
.actor(PartyDataFactory.partyTO())
.build();
}

Expand All @@ -28,6 +29,7 @@ public List<EndorsementChainTransactionTO> endorsementChainTransactionTOList() {
.platformHost("localhost:8443")
.timestamp(System.currentTimeMillis())
.transferee("initialTransferee@localhost:8443")
.actor(PartyDataFactory.partyTO())
.build();

return List.of(initialTransaction, EndorsementChainTransactionTODataFactory.endorsementChainTransactionTO());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ public record EndorsementChainTransactionTO(
String platformHost,

@NotNull
String transferee //ToDo must be a (subset of) the party object
String transferee, //ToDo must be a (subset of) the party object

// @NotNull // TODO: Add this when we are ready.
PartyTO actor
) {
@Builder(toBuilder = true)
public EndorsementChainTransactionTO {}
Expand Down

0 comments on commit acc9c79

Please sign in to comment.