Git Product home page Git Product logo

asyncvoter-api's Introduction

Agile Ventures

For discussion of all those things that are Agile Ventures in general rather than the technology of any project in particular, as well as a place to hold documents on how to get stuff done:

Updating the agileventures.org website

The agileventures.org website fetches content from this repository.

Edit any of the pages in the root directory of this repo. Log in to the console on the production server and execute the job by running GithubStaticPagesJob.run

asyncvoter-api's People

Contributors

arreche avatar chaiwa-berian avatar joaopapereira avatar katy310 avatar mtc2013 avatar sysrex avatar tansaku avatar vardyb avatar waffle-iron avatar zsuark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asyncvoter-api's Issues

Unit tests are not closing MongoDB connection properly

I'm writing unit tests on the Vote controller.

Trying to grab the mongodb via mongoose times out.

When I remove the Story routes tests, it works.

It looks like the Story routes test doesn't close the connection properly.

Proposed initial REST API

Based on our chats, my proposed REST API up for discussion and voting.

ROUTES

Start a vote on a story

POST /stories

View all stories

GET /stories

View a specific story

GET /stories/:storyId

Cast a vote on a story

POST /stories/:storyId/votes

View all votes on a story

GET /stories/:storyId/votes

View a specific vote on a story

GET /stories/:storyId/votes/:voteId

slack integration

we imagine from within a project channel starting a vote like this:

@async_bot start vote on http://ticket/id

then bot would respond with vote instructions in channel

vote on http://ticket/id "title", please DM 1(simple), 2 (medium), 3(hard) to me at @async_bot - please discuss here in channel or in ticket as preferred

then individuals DM bot and bot updates channel with names of voters, revealing the vote values when we reach a threshold of, say 3 votes

would love to have vote take on icon of person who started the vote

terminology: adjust from "story" to "ballot"?

in terms of the domain we might make the following statement.

Users cast individual Votes, on Ballots that concern Stories. Stories are uniquely identified by a URL, and will often have a Name, which is also the Name of the Ballot. The result of a Ballot will be when all the Users votes are the same, e.g. all 1s, all 2s, or all 3s.

Probably we don't need separate models for users or stories at the moment as they can be uniquely identified by URLs.

Refactor tests

To avoid git conflicts, and to keep everything clear, cucumber step definitions should have differing features/support/world.js files.

E.g. for features/cast_vote.feature there should be a features/support/cast_vote_world.js, and for features/start_vote.feature there should be a features/support/start_vote_world.js file.

Change server port on test

Make the server port configurable to ensure that the tests and the server do not run in the same port

Chai/Mocha tests are affecting Cucumber

console.log's and other output from Chai/Mocha tests are occurring when we run cucumber tests.

console.log/debug messages should stay separate in the two different types of testing

Story schema definition

Currently the schema for the Story model provides no actual identifiers or constraints. It is defined as such:

var mongoose = require('mongoose');
var schema = new mongoose.Schema({
    name: 'string',
    size: 'string',
    url: 'string'
});

var Story = mongoose.model('Story', schema);

module.exports = Story;`

In my local version I've redefined it as:

var mongoose = require('mongoose');

var storySchema = new mongoose.Schema({
    name: {
        type: String,
        required: true,
        unique: true // <-- Really?
    }
    size: String,
    url: {
        type: String,
        required: true,
        unique: true // <-- Identifier
    }
});

var Stories = mongoose.model('Story', storySchema);

module.exports = Stories;

Questions: AFAIK, the URL should be unique, however should the name really be unique? Can one issue be voted on multiple times? (E.g. to address further technical concerns/requirements rather than user ones.)

Votes routing to separate file

In the latest implementation of the votes domain, as the votes are a sub-route of story, they are handled in the src/story/story.routes.js file.

Should, if it is even possible, the votes routing have a separate route file?

It would be something like src/vote/vote.routes.js which is pointed to either in the src/routes.js file or src/story/story.routes.js.

Closing Voting Feature

Feature: Closing voting
 As a developer
 I want to be able to close voting on a specific issue
 So that I can start working on the story

Show votes on story

Feature: Show story votes
  As a developer
  So that I can get an update on a story that I care about 
  I want to see the votes cast on a story

See related discussion in #51

Abstract out configurations into separate file

Currently in the bin/server.js file we have lines like:

mongoose.connect('mongodb://localhost/asyncvoter');
...
var server = app.listen(3000, function () {
...

So we have all of our configs/options being hard-coded directly into the server code. It would be good if we could decouple this and place the options in a config.js file - especially as we move forward and server.js becomes larger.

Example setup:

config.js:

module.exports = {
   'mongoUri': 'mongodb://localhost:27017/asyncvoter',
   'port': 3000,
   ...
}

bin/server.js:

var config = require('../config.js');
...
mongoose.connect(config.mongoUri);
...
var server = app.listen(config.port, function() {
...

Sensible config defaults when .env is missing

Currently if the .env file is missing, the server fails to start.

E.g. server port is defined by .env variable PORT

We should provide some sensible defaults (where possible) so that the server can run when the environment variables are missed (except when it's an absolute must).

eg. rather than var port = process.env.PORT we use var port = process.env.PORT || 3000 or var port = process.env.PORT || defaultConfig.port

Automatic code indenting

Is there a way to have the code indented/formatted consistently whenever it is committed to the repo?

Web UI

Maybe an epic with multiple stories

As a developer,
So that I can vote on a story
I would like a web UI for when I don't have access to Slack

As a developer
So that I can see the current state of a project (planning)
I would like to see details of whatever story is currently being voted on and the state of the vote

As a developer
So that I know my vote has been accepted
I would like the vote status to include who has voted

As a developer
So that I know which cool dudes have voted so far
I would like the vote status to include who has voted

  • register your vote (veneer on top API - POST /stories/34/votes {size: 1})
  • see the state of the current vote
    • user would see
      • title
      • link
      • who has voted, but not the vote values
    • when we have >= 3 votes, then the state would show the vote values --> prompt discussion, focussing on the minority (e.g votes are 3,3,3,2 - then ask person who voted two to say why)

Routes definitions

Currently in server.js we have:

app.use(require('../src/story/story.routes.js'));

Then in the story router we do:

router.get('/stories', controller.allStories);
router.post('/stories', controller.createStory);

This sets all routes to go to the story router. So we will need to then call in other routes from that file - breaking the domain model.

Either we use something like:

Server.js:

app.use('/stories', require('../src/story/story.routes.js'));

Story route:

router.get(controller.allStories);
router.post(controller.createStory);

Or:

Server.js

app.use('../src/routes.js')

src/routes.js

router.use('/stories', require('story/story.routes.js'));

Story route:

router.get(controller.allStories);
router.post(controller.createStory);

Ensuring all features hook into Cucumber

Yesterday we installed CucumberJs (just waiting for Pull Request)

Now Cucumber is working we need to:

a) ensure that the current features all exist within the features directory
b) possibly review those features
c) ensure the appropriate hooks (step definitions) are there for the existing features

DRY out model specs

we have the following over and over:

          let result = {
            exec: (func) => func([]),
            sort: (v) => {return result;} 
          };

could it be in a before block?

better error handling

We probably need to put in better error handling - rather than just crashing the server

issues with start vote feature

Feature: Start Ballot
  As a developer
  So that I can start working on a story, bugfix or chore
  I would like to initiate an asynchronous ballot to get an estimate of how difficult the story will be

  Scenario:
    Given that I submit the URL 'https://github.com/AgileVentures/AsyncVoter/issues/4'
    Then the bot should return an id of that new ballot
  # Scenario: 5-option-ballet

  # Scenario: 3-option-ballet

this should be called Start Vote - it should test creation of story with name (as well as URL) and comments should be removed

Update README

Readme still says:
To run all the tests execute

npm run spec

Instead of
npm test

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.