Skip to content

Commit bdea53d

Browse files
authored
Merge pull request #3789 from IntersectMBO/3745-display-authors-for-live-voting-governance-actions
(fix#3745) authors case formatting for gov actions
2 parents 34ebe49 + b7deafb commit bdea53d

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

govtool/backend/sql/list-proposals.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ SELECT
308308
json_agg(
309309
json_build_object(
310310
'name', off_chain_vote_author.name,
311-
'witness_algorithm', off_chain_vote_author.witness_algorithm,
312-
'public_key', off_chain_vote_author.public_key,
311+
'witnessAlgorithm', off_chain_vote_author.witness_algorithm,
312+
'publicKey', off_chain_vote_author.public_key,
313313
'signature', off_chain_vote_author.signature
314314
)
315315
) FILTER (WHERE off_chain_vote_author.id IS NOT NULL),
@@ -367,4 +367,4 @@ GROUP BY
367367
off_chain_vote_gov_action_data.title,
368368
off_chain_vote_gov_action_data.abstract,
369369
off_chain_vote_gov_action_data.motivation,
370-
off_chain_vote_gov_action_data.rationale;
370+
off_chain_vote_gov_action_data.rationale;

govtool/backend/src/VVA/API/Types.hs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,18 +422,31 @@ instance ToSchema ProposalAuthors where
422422
& example ?~ toJSON
423423
[ object
424424
[ "name" .= ("Alice" :: Text)
425-
, "witness_algorithm" .= ("algo" :: Text)
426-
, "public_key" .= ("key" :: Text)
425+
, "witnessAlgorithm" .= ("algo" :: Text)
426+
, "publicKey" .= ("key" :: Text)
427427
, "signature" .= ("sig" :: Text)
428428
]
429429
, object
430430
[ "name" .= ("Bob" :: Text)
431-
, "witness_algorithm" .= ("algo2" :: Text)
432-
, "public_key" .= ("key2" :: Text)
431+
, "witnessAlgorithm" .= ("algo2" :: Text)
432+
, "publicKey" .= ("key2" :: Text)
433433
, "signature" .= ("sig2" :: Text)
434434
]
435435
]
436436

437+
exampleProposalAuthors :: Text
438+
exampleProposalAuthors =
439+
"[\
440+
\ {\"name\": \"Alice\",\
441+
\ \"witnessAlgorithm\": \"Ed25519\",\
442+
\ \"publicKey\": \"abcdef123456\",\
443+
\ \"signature\": \"deadbeef\"},\
444+
\ {\"name\": \"Bob\",\
445+
\ \"witnessAlgorithm\": \"Ed25519\",\
446+
\ \"publicKey\": \"123456abcdef\",\
447+
\ \"signature\": \"beefdead\"}\
448+
\]"
449+
437450
deriveJSON (jsonOptions "proposalResponse") ''ProposalResponse
438451

439452
exampleProposalResponse :: Text
@@ -463,7 +476,9 @@ exampleProposalResponse = "{ \"id\": \"proposalId123\","
463476
<> "\"cCNoVotes\": 0,"
464477
<> "\"cCAbstainVotes\": 0,"
465478
<> "\"prevGovActionIndex\": 0,"
466-
<> "\"prevGovActionTxHash\": \"47c14a128cd024f1b990c839d67720825921ad87ed875def42641ddd2169b39c\"}"
479+
<> "\"prevGovActionTxHash\": \"47c14a128cd024f1b990c839d67720825921ad87ed875def42641ddd2169b39c\","
480+
<> "\"authors\": " <> exampleProposalAuthors
481+
<> "}"
467482

468483
instance ToSchema Value where
469484
declareNamedSchema _ = pure $ NamedSchema (Just "Value") $ mempty

0 commit comments

Comments
 (0)