Skip to content

Conversation

@jbriones1
Copy link
Contributor

@jbriones1 jbriones1 commented Sep 8, 2025

Updates

  • Updated the metadata for the elections endpoints so that our docs are accurate
  • Singularized the election endpoints and moved the election endpoints to their own root path
    • /elections -> /election
    • /elections/registration/ -> /registration
    • /elections/nominee_info/ -> /nominee
    • This enforces a pattern where each table has its own set of operations. We can always make endpoints that do more complicated things, which compose multiple operations in a single call.
  • Changed GET /elections/list -> GET /election
    • Removed the constraint that elections can't be named "list"
  • Updated all PATCH endpoints to the following pattern:
    • The URL params are used to target a specific database entry
    • The body holds the values that will be used to update the entry
    • The entry's fields will only be updated if there is an explicit value set in the body (so a body.speech that's NULL will set it to NULL in the database, but if body.speech doesn't exist then the entry's value will not change)
  • Updated all the POST endpoints to use the body as the entry's values
  • DELETE endpoints target a single entry in the database using the URL parameters
  • Made some endpoints require you to be an admin
  • All current elections unit tests should all pass
  • Made enums for officer positions and election statuses
  • available_positions will automatically be converted to a str when saved to the database and to a list[str] when used in the Python code
  • Moved nominee-application-related things to the registrations folder
  • Moved nominee-info-related things to the nominees folder

Todo (Part 3)

  • DELETE /nominee/{election_name}/{computing_id}/{position: to delete nominees
  • POST /nominee: to create nominees (PATCH does this, but semantically that's kind of weird)
  • Add unit tests for all the newer endpoints
  • Break up unit tests for easier debugging
  • Remove some constant strings that are floating around and convert them to enums if possible

@jbriones1 jbriones1 requested a review from p-north September 8, 2025 07:42
@jbriones1 jbriones1 changed the title Update: Various Elections API changes Update: Various Elections API changes, Part 2 Sep 11, 2025
Copy link
Contributor

@p-north p-north left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Mostly fine, just refer to the suggestions below.

@jbriones1 jbriones1 requested a review from p-north September 20, 2025 08:39
Copy link
Contributor

@p-north p-north left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Looks good

@jbriones1 jbriones1 merged commit 6e5c539 into main Sep 23, 2025
3 checks passed
@jbriones1 jbriones1 deleted the update_elections-api branch September 23, 2025 03:18
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.

3 participants