This project is a REST API. It is an implementation of Copeland's Method, also known as Pairwise comparison, in voting theory. You can refer to this website for better understanding CLICK HERE!
It is recommended to use IntelliJ as your IDE if you want to test this project out for yourself.
Tools needed:
- Postman
- IntelliJ (Optional)
- PostgresSQL
- DBeaver (Optional)
There are two main Java Class in this project. Election and Ballot
What are the fields in Election class?
- idNo (Long)
- title (String)
- category (String)
- status (String)
- candidateCount (Integer)
- candidates (List of String)
What are the fields in Ballot class?
- idNo (Long)
- electionIdNo (Long)
- selectedCandidates (List of Integer)
Election class purpose is to start a voting session of any type. EX: Food voting, leader voting, vacation place voting, etc. On the other hand, Ballot class sole purpose is to hold votes for a specific voting session.
- Election
- /api/v1/elections | POST METHOD - To create new Election session
- /api/v1/elections/{idNo} | GET METHOD - To get one specific election session with ID in URI
- /api/v1/elections/{idNo}/votes | GET METHOD - To get all votes in the Election session with the given ID in URI
- /api/v1/elections/{idNo}/winner | GET METHOD - To get the winner of the Election session using the Copeland's method algorithm
- Ballot
- /api/v1/ballots | POST METHOD - To create new vote targeting an election session
Note
If you are interested in improving this project, feel free to make a pull request.