Type the event data JSON #17

Open
opened 2026-06-19 01:47:23 +00:00 by maybe-yiyi · 0 comments
maybe-yiyi commented 2026-06-19 01:47:23 +00:00 (Migrated from codeberg.org)

Background

event.data is an untyped serde_json::Value accessed by string keys (event.data["vote_type"], ["vote_options"], ["threshold"], ["proxy"], ["visibility"]["participants"]) across votes, event, and export handlers.

Tasks

  • Define a typed EventData struct (with serde derives) capturing vote_type, vote_options, threshold, proxy, and visibility.
  • Provide a helper to deserialize event.data into EventData.
  • Replace stringly-typed access sites with the typed struct.

Files: votes/handlers.rs, event/handlers.rs, session/export.rs

**Background** `event.data` is an untyped `serde_json::Value` accessed by string keys (`event.data["vote_type"]`, `["vote_options"]`, `["threshold"]`, `["proxy"]`, `["visibility"]["participants"]`) across votes, event, and export handlers. **Tasks** - Define a typed `EventData` struct (with `serde` derives) capturing `vote_type`, `vote_options`, `threshold`, `proxy`, and `visibility`. - Provide a helper to deserialize `event.data` into `EventData`. - Replace stringly-typed access sites with the typed struct. Files: `votes/handlers.rs`, `event/handlers.rs`, `session/export.rs`
Sign in to join this conversation.
No description provided.