Skip to content

Commit

Permalink
Make Delegate Statement Query Columns Explicit & Type Safe (#740)
Browse files Browse the repository at this point in the history
  • Loading branch information
jefag authored Jan 17, 2025
1 parent 42d5a50 commit a0c1035
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/app/api/common/votes/getVotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,32 @@ async function getVotesForDelegateForAddress({
proposal_id,
voter,
support,
SUM(weight::numeric) as weight,
SUM(weight) as weight,
STRING_AGG(distinct reason, '\n --------- \n') as reason,
MAX(block_number) as block_number,
params
FROM (
SELECT
*
transaction_hash,
proposal_id,
voter,
support,
weight::numeric,
reason,
block_number,
params
FROM ${namespace}.vote_cast_events
WHERE voter = $1 AND contract = $2
UNION ALL
SELECT
*
transaction_hash,
proposal_id,
voter,
support,
weight::numeric,
reason,
block_number,
params
FROM ${namespace}.${eventsViewName}
WHERE voter = $1 AND contract = $2
) t
Expand Down

0 comments on commit a0c1035

Please sign in to comment.