aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/events.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/events.rs')
-rw-r--r--src/api/events.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/api/events.rs b/src/api/events.rs
index 3291f02..2fa6719 100644
--- a/src/api/events.rs
+++ b/src/api/events.rs
@@ -108,7 +108,8 @@ async fn event(State(state): State<AppState>, Path(id): Path<String>) -> Respons
}
/// `GET /events/counts`: what counts, as the store reads now: the current version, each
-/// party's keys and nodes, the values at places, and the members.
+/// party's keys and nodes, the values at places, the members, and the proposals on the
+/// current version, each with the events proposing it and the votes on it.
async fn counts(State(state): State<AppState>) -> Response {
with_store(&state, |store| {
let read = store.state();
@@ -131,6 +132,16 @@ async fn counts(State(state): State<AppState>) -> Response {
.iter()
.map(|(path, value)| (path.clone(), plain(value)))
.collect();
+ let proposals: serde_json::Map<String, JsonValue> = read
+ .ballots(&current.hash)
+ .into_iter()
+ .map(|(hash, ballot)| {
+ (
+ hash.to_string(),
+ json!({"proposals": ids(ballot.proposals), "votes": ids(ballot.votes)}),
+ )
+ })
+ .collect();
json!({
"version": {
"number": current.number,
@@ -140,6 +151,7 @@ async fn counts(State(state): State<AppState>) -> Response {
"parties": parties,
"values": values,
"members": read.members(),
+ "proposals": proposals,
})
})
}