-
-
Notifications
You must be signed in to change notification settings - Fork 83
Description
-
Describe the bug
TheVoteschema defines achangeset/2function that casts no fields and validates nothing (cast(attrs, [])+validate_required([])), providing zero input validation. However, the app never uses this changeset votes are inserted directly via%Vote{…} |> Repo.insert(). -
Expected behavior
Schema changesets should enforce required fields and proper casting/validation (e.g.cast(attrs, [:dealt_card_id, :player_id])+validate_required([:dealt_card_id, :player_id])) to prevent invalid data, follow Ecto best practices, and protect against future misuse. -
Desktop (please complete the following information):
OS: N/A (server-side schema / code quality issue)
Browser: N/A (server-side schema / code quality issue)
Version: N/A (server-side schema / code quality issue) -
Additional context
Not currently exploitable DB foreign-key constraints + direct struct insertion prevent bad data today. Still poor practice / technical debt: empty changeset violates Ecto conventions and creates risk if anyone later starts usingVote.changeset/2(e.g. API, admin form, bulk insert). Fix recommended for maintainability and defense-in-depth.