Giter Club home page Giter Club logo

v24-bears-team-04-be's Introduction

My Choice API

Heroku App: https://mychoicebe.herokuapp.com/

API Documentation: https://mychoicebe.herokuapp.com/swagger-ui/

VOTE AND RESULTS

Endpoint: /vote/<election-id>

GET

FORMAT

{
  "id": <ELECTION ID>,
  "position_set": [
    {
      "id": <POSITION-ID>,
      "candidate_set": [
        ...
        {
          "id": <CANDIDATE ID>,
          "first_name": "",
          "last_name": "",
          "picture_self": null,
          "party": "",
          "gender": "",
          "ethnicity": "",
          "votes": 0,
          "positions": [
            ...
            <POSITION ID>,
            ...        
          ]
        }
        ...
      ],
      "name": "<POSITION NAME>",
      "locality": "<LOCALITY NAME>",
      "seats": 1,
      "election": <ELECTION ID>
    }
  ],
  "title": "<ELECTION TITLE>",
  "start_time": "2020-11-01T00:00:00Z",
  "end_time": "2020-11-04T00:00:00Z"
}

EXAMPLE

{
  "id": 3,
  "position_set": [
    {
      "id": 1,
      "candidate_set": [
        {
          "id": 2,
          "first_name": "Donald",
          "last_name": "Trump",
          "picture_self": null,
          "party": "Other",
          "gender": "Male",
          "ethnicity": "",
          "votes": 2,
          "positions": [
            1,
            4
          ]
        },
        {
          "id": 1,
          "first_name": "Joe",
          "last_name": "Biden",
          "picture_self": null,
          "party": "Other",
          "gender": "Male",
          "ethnicity": "",
          "votes": 5,
          "positions": [
            1,
            5
          ]
        }
      ],
      "name": "President",
      "locality": "USA",
      "seats": 1,
      "election": 3
    },
    {
      "id": 2,
      "candidate_set": [
        {
          "id": 3,
          "first_name": "Kamala",
          "last_name": "Harris",
          "picture_self": null,
          "party": "Other",
          "gender": "Female",
          "ethnicity": "",
          "votes": 4,
          "positions": [
            2
          ]
        },
        {
          "id": 4,
          "first_name": "Mike",
          "last_name": "Pence",
          "picture_self": null,
          "party": "Other",
          "gender": "Male",
          "ethnicity": "",
          "votes": 1,
          "positions": [
            2
          ]
        }
      ],
      "name": "Vice President",
      "locality": "USA",
      "seats": 1,
      "election": 3
    },
    {
      "id": 3,
      "candidate_set": [],
      "name": "Region 1 Senator",
      "locality": "R1",
      "seats": 2,
      "election": 3
    }
  ],
  "title": "2020 General Election",
  "start_time": "2020-11-01T00:00:00Z",
  "end_time": "2020-11-04T00:00:00Z"
}

POST

FORMAT

{
  ...
  "<POSITION ID>": "<CANDIDATE ID>",
  ...
}

EXAMPLE

{
  ...
  "1": "2",
  ...
}

v24-bears-team-04-be's People

Contributors

cdmims23 avatar evchin avatar mainangethe avatar sophyphreak avatar tropicalchancer avatar

Watchers

 avatar  avatar  avatar

v24-bears-team-04-be's Issues

User can be an Election Officer (EO)

An Election Officer is not a voter
An EO is able to manage elections
An EO is able to manage positions
An EO is able to manage political parties
An EO is able to manage candidates
An EO email cannot be the same as a voters

Potential EO details

  • Name
  • Email
  • Staff ID

User is able to manage an election

Ability to curate an election in the system.
Set it's name
Set it's date
Set it's voting period
Run a mock election with sample of voters

User is unable to cast a vote using the POST /api/vote EP

Description
When I send a candidate's name to the EP, I am getting a Test Name with 0 votes every time with a successful 200 OK status.

Expected Result
The EP should return my candidate's name & increase his/her vote by 1 every time I vote.

Actual Result
Get same result, _id: 1, Name: Test Name, Votes: 0

Steps To Recreate

  1. Use mychoice-api.herokuapp.com as the base_url
  2. Enter EP: /api/vote with the POST method
  3. Add a candidate_name key:value pair in the body as JSON
{ 
    "candidate_name": "John McCain"
}
  1. Send the request
  2. View results

Screenshot
BUG_unable_to_cast_vote_062121102020.png

DATA - Locality

Map the constituencies in Kenya

  • Country [Name, Country Code, ISO-Long, ISO-Short]
  • County [ Name, Code ]
  • Constituency [ Name ,Code ]

Login EP returns HTML

When you send a request to the login, it returns a HTML page as opposed to user details of the person who's logged in.

Expected Results

The user who has logged in

Actual Results

Dashboard HTML page

Steps to Recreate

  1. Access the login url - https://mychoicebe.herokuapp.com/login
  2. Send body data as json
{
  "username": "johndoe",
  "password": "abcd"
}
  1. Confirm the results you get back

Screenshots

BUG_login_results_html_052709112020

Ballot EP returns HTML page

Expecting results as JSON, getting results as HTML.

Expected Results

The EP to send back feedback as JSON.

Actual Results

Receiving feedback as a HTML page.

Steps to Recreate

  1. Send a request to https://mychoicebe.herokuapp.com/vote/3
  2. Confirm you get HTML page in response

Wireframe - Ballot form

  • Allow a user to view the candidates in the ballot
  • Allow a user to select their preferred candidate

User is able to manage positions

A position belongs to an election
A position may have many candidates running in it.
Candidates can only appear once in an election
A position may be restricted by age
A position may be restricted to a region

User is able to manage candidates

Candidates are people who will run for an election.
A candidate may belong to a political party.
A candidate can only run for 1 position in an election
Certain positions have age restrictions

Candidate potential details

  • Name
  • Gender
  • Date of Birth
  • Ethnicity
  • Passport Photo
  • Political Party Affiliation

User is able to login

A user should be able to login to the application

  • It should display his role
  • It should display his constituency as a voter
  • It should have 2FA for real user confirmation
  • It should automatically timeout after 10 mins of inactivity

Potential Login Details

  • Email
  • Password
  • OTP Token
  • Google reCaptcha v3

Users can register as voters

A voter can participate in an election
A voter can self-register
A voter can only have one physical identity
A voter can not be older than 120 years old from his date of birth
A voter can only vote in positions that belongs to his region
A voter can vote for himself as a candidate
A voter has to be approved before logging in

Potential Voter details

  • name
  • gender
  • date_of_birth
  • ethnicity
  • email
  • mobile
  • constituency | county | state | county
  • passport_photo
  • identification_number
  • identification_type
  • identification_card_photo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.