-
Notifications
You must be signed in to change notification settings - Fork 3
Description
(This emerged on liquidvotingio/decidim-module-liquidvoting#31 (comment))
Add a new voting_method graphql field to vote mutations and queries, and to voting results.
A string field mapping to entries in a new voting_methods db table (with matching Ecto schema) that gets upserted so we avoid the need for pre-seed or for an admin interface to manage it.
It would map to an association for Vote and VoteResult schemas. For Vote, for example:
defmodule LiquidVoting.Voting.Vote do
schema "votes" do
belongs_to :voting_methods, VotingMethodsSame for VotingResult.
> (@jinjagit) And this field would be optional? To allow our api to still work in it's purest, no voting method specified, way, as (for example) in the api readme examples. So we could use a create_vote api function, for example, that picks up the voting_method field if present and does the voting_method table stuff, and if no voting_method is specified the votes/results etc. are processed as they are now (without considering any voting_method).
👍 agreed, it should be optional. To avoid splitting db queries we can just have an empty entry in the db.
[EDIT: voting_method now required, not optional - see comment below]
The new VotingMethod schema would also be constrained by organization id.