Skip to content

feat(votes): typed Vote model for AsobiVotes#20

Merged
Taure merged 1 commit into
mainfrom
feat/typed-votes
Jul 4, 2026
Merged

feat(votes): typed Vote model for AsobiVotes#20
Taure merged 1 commit into
mainfrom
feat/typed-votes

Conversation

@Taure

@Taure Taure commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Untangles #15. That branch predated #13/#17/#19 and had ~60 conflicting files; this extracts the only content still unique to it — the typed Vote model — onto a clean branch off main.

What this adds

  • Runtime/Models/VoteModels.csVote + VoteListResponse.
  • AsobiVotes.GetAsync/ListForMatchAsync now return Vote/VoteListResponse instead of raw JSON strings.
  • JsonHelper.ParseVote/ParseVoteList.

Correctness

Verified the model against the backend schema (asobi_vote.erl): scalar fields (id, match_id, template, method, turnout, eligible_count, window_ms, timestamps) deserialize via JsonUtility; the four jsonb fields (options array, votes_cast/result/distribution objects) are captured as raw JSON via ExtractJsonField, matching the established ParseMatchRecord convention. Http.GetRaw confirmed present on main post-#19.

What was dropped from #15 (already landed elsewhere)

Tests

No license-free unit test: JsonHelper depends on UnityEngine.JsonUtility, so it isn't compiled by the .NET dispatch project (which builds only AsobiDispatcher). Like every other Parse* method, the vote path is exercised by the PlayMode suite once UNITY_LICENSE is set.

Closes #15.

Extracts the only still-unique content from the stale #15 branch: a typed
Vote/VoteListResponse model so AsobiVotes.GetAsync/ListForMatchAsync return
parsed objects instead of raw JSON strings. Scalar fields deserialize via
JsonUtility; the jsonb fields (options/votes_cast/result/distribution)
arrive as arrays/objects and are captured as raw JSON via ExtractJsonField,
matching the established ParseMatchRecord convention.

#15's other changes are dropped as already-landed: auth (#19), the
dispatcher/test infra (#13), .editorconfig (#17).
@Taure
Taure merged commit 9be5704 into main Jul 4, 2026
3 checks passed
@Taure
Taure deleted the feat/typed-votes branch July 4, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant