method | path | body |
---|---|---|
POST | /admin/sign_in | { email: "", password: "" } |
POST | /admin/elections | { name: "", cover: "", notice: "", starts_at: "", ends_at: "" } |
PUT | /admin/elections/:id | { name: "", cover: "", notice: "", starts_at: "", ends_at: "" } |
Last active
March 19, 2021 12:17
-
-
Save thiagogsr/b2926fce92fd0fb2bb492e33d4a48446 to your computer and use it in GitHub Desktop.
Voting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Elixir CircleCI 2.0 configuration file | |
# https://onboarding.circleci.com/project-setup/github/thiagogsr/voting | |
# | |
# Check https://circleci.com/docs/2.0/language-elixir/ for more details | |
version: 2 | |
jobs: | |
build: | |
docker: | |
# specify the version here | |
- image: circleci/elixir:1.10.1 | |
environment: | |
MIX_ENV: test | |
- image: circleci/postgres:11.5-alpine | |
working_directory: ~/repo | |
steps: | |
- checkout | |
- run: mix local.hex --force # install Hex locally (without prompt) | |
- run: mix local.rebar --force # fetch a copy of rebar (without prompt) | |
- restore_cache: | |
key: deps-cache-{{ checksum "mix.lock" }} | |
- run: mix do deps.get, deps.compile | |
- save_cache: | |
key: deps-cache-{{ checksum "mix.lock" }} | |
paths: | |
- deps | |
- ~/.mix | |
- _build | |
- run: mix compile --warnings-as-errors | |
- run: # special utility that stalls main process until DB is ready | |
name: Wait for DB | |
command: dockerize -wait tcp://localhost:5432 -timeout 1m | |
- run: mix do ecto.create, ecto.migrate | |
- run: mix test | |
- run: mix format --check-formatted | |
- run: mix credo --strict |
- CreateElection
- Future dates
- UpdateElection
- Only before start
- CreateCandidate
- Only before election start
- UpdateCandidate
- Only before election start
- ImportVoters
- Only before election start
- Parse CSV, validate and insert_all
- CreateVoter
- Only before election start
- UpdateVoter
- Only before election start
- LoadPolls
- By voter admission_date and registration_code
- Vote
- Only between election starts_at and ends_at
- Insert vote
- Update voter
voted
- CreateAdmin
- AdminSignIn
- VoterSignIn
sudo apt update
sudo apt upgrade
sudo apt install -y vim snap build-essential
- Install VSCode
sudo snap install code --classic
- Install Postman
sudo snap install postman
- Add apt repository
sudo vim /etc/apt/sources.list.d/pgdg.list
- Paste
deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main
- Then run
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update
sudo apt install postgresql libpq-dev
- Trust connections to avoid password asking
sudo vim /etc/postgresql/12/main/pg_hba.conf
- Change all the methods to
trust
# Database administrative login by Unix domain socket
local all postgres trust
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
sudo apt install libssl-dev zlib1g-dev automake autoconf libncurses5-dev curl
admin
- name string not null
- email string not null
- password_hash string not null
candidate
- election_id
- voter_id
- avatar string
- slogan string
- number integer not null
- votes integer not null default 0
- active bool not null default true
election
- name string not null
- cover string
- notice string
- starts_at datetime not null
- ends_at datetime not null
- created_by
voter
- election_id
- name string not null
- admission_date date not null
- registration_number string not null
- role string not null
- voted bool not null default false
vote
- election_id
- candidate_id
- inserted_at datetime not null
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment