Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions govtool/backend/sql/list-proposals.sql
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ SELECT
json_agg(
json_build_object(
'name', off_chain_vote_author.name,
'witness_algorithm', off_chain_vote_author.witness_algorithm,
'public_key', off_chain_vote_author.public_key,
'witnessAlgorithm', off_chain_vote_author.witness_algorithm,
'publicKey', off_chain_vote_author.public_key,
'signature', off_chain_vote_author.signature
)
) FILTER (WHERE off_chain_vote_author.id IS NOT NULL),
Expand Down Expand Up @@ -367,4 +367,4 @@ GROUP BY
off_chain_vote_gov_action_data.title,
off_chain_vote_gov_action_data.abstract,
off_chain_vote_gov_action_data.motivation,
off_chain_vote_gov_action_data.rationale;
off_chain_vote_gov_action_data.rationale;
25 changes: 20 additions & 5 deletions govtool/backend/src/VVA/API/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -422,18 +422,31 @@ instance ToSchema ProposalAuthors where
& example ?~ toJSON
[ object
[ "name" .= ("Alice" :: Text)
, "witness_algorithm" .= ("algo" :: Text)
, "public_key" .= ("key" :: Text)
, "witnessAlgorithm" .= ("algo" :: Text)
, "publicKey" .= ("key" :: Text)
, "signature" .= ("sig" :: Text)
]
, object
[ "name" .= ("Bob" :: Text)
, "witness_algorithm" .= ("algo2" :: Text)
, "public_key" .= ("key2" :: Text)
, "witnessAlgorithm" .= ("algo2" :: Text)
, "publicKey" .= ("key2" :: Text)
, "signature" .= ("sig2" :: Text)
]
]

exampleProposalAuthors :: Text
exampleProposalAuthors =
"[\
\ {\"name\": \"Alice\",\
\ \"witnessAlgorithm\": \"Ed25519\",\
\ \"publicKey\": \"abcdef123456\",\
\ \"signature\": \"deadbeef\"},\
\ {\"name\": \"Bob\",\
\ \"witnessAlgorithm\": \"Ed25519\",\
\ \"publicKey\": \"123456abcdef\",\
\ \"signature\": \"beefdead\"}\
\]"

deriveJSON (jsonOptions "proposalResponse") ''ProposalResponse

exampleProposalResponse :: Text
Expand Down Expand Up @@ -463,7 +476,9 @@ exampleProposalResponse = "{ \"id\": \"proposalId123\","
<> "\"cCNoVotes\": 0,"
<> "\"cCAbstainVotes\": 0,"
<> "\"prevGovActionIndex\": 0,"
<> "\"prevGovActionTxHash\": \"47c14a128cd024f1b990c839d67720825921ad87ed875def42641ddd2169b39c\"}"
<> "\"prevGovActionTxHash\": \"47c14a128cd024f1b990c839d67720825921ad87ed875def42641ddd2169b39c\","
<> "\"authors\": " <> exampleProposalAuthors
<> "}"

instance ToSchema Value where
declareNamedSchema _ = pure $ NamedSchema (Just "Value") $ mempty
Expand Down