Skip to content
Isaac Dontje Lindell edited this page Oct 25, 2013 · 16 revisions

Welcome to the TapVote wiki!

Here is our proposal: TapVote proposal

Random Info

API data structures

/createSurvey:

surveyData = { 'title':'"Because clickers are SO 1999."', 
               'questions': [{'question': 'Which is best?', 
                              'answers': ["Puppies", "Cheese", "Joss Whedon", "Naps"]
                            }],
               'password':'supersecretpassword'
             }

/getSurveyInfo:

var ret = { title: "A sweet survey",
            questions: [
                { id:12,
                  value:"What is your favorite color",
                  answers: [
                      {id:45, value:"blue"},
                      {id:32, value:"red"}
                  ]
                },
                { id:14,
                  value:"What is your favorite food",
                  answers: [
                      {id:21, value:"pizza"},
                      {id:18, value:"cake"},
                      {id:12, value:"brains"}
                  ]
                }
            ]
          };

Database

To set up a test database on Ubuntu (maybe all *nix?):

  1. $ sudo apt-get install postgresql
  2. $ sudo -u postgres psql postgres. Connects to the newly installed Postgres server using the default postgres database
  3. # \password postgres. Will prompt you for a password. Probably should use wearetapvote for now.
  4. # create database tapvotetest;
  5. CTRL-D to exit psql.
  6. $ sudo -u postgres psql tapvotetest. Connect to the newly created tapvotetest database.
  7. Create the schema:
CREATE TABLE survey (
    id           serial    PRIMARY KEY,
    title        text,
    password     text
);

CREATE TABLE question (
    id           serial    PRIMARY KEY,
    "surveyId"   integer   REFERENCES survey(id),
    value        text
);

CREATE TABLE answer (
    id           serial    PRIMARY KEY,
    "questionId" integer   REFERENCES question(id) ,
    value text
);

CREATE TABLE vote (
    id           serial,
    "questionId" integer   REFERENCES question(id),
    "answerId"   integer   REFERENCES answer(id)
);

The connection string used to connect to the database using Node.js is: var CONNSTRING = "postgres://postgres:wearetapvote@localhost/tapvotetest";

Clone this wiki locally