agileventures / asyncvoter-api Goto Github PK
View Code? Open in Web Editor NEWFor Voting on Stories and Tickets remotely and asynchronously e.g. planning poker
For Voting on Stories and Tickets remotely and asynchronously e.g. planning poker
Use npm shrinkwrap
to lock down dependencies in production. (Kinda Gemfile.lock
)
See
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
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
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
pop this on heroku
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() {
...
Setting up a linter as ESLint
will ensure the code consistency and detect potential bugs.
Maybe you can just enable http://codeclimate.com for now.
we have the following over and over:
let result = {
exec: (func) => func([]),
sort: (v) => {return result;}
};
could it be in a before block?
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);
Based on our chats, my proposed REST API up for discussion and voting.
POST /stories
GET /stories
GET /stories/:storyId
POST /stories/:storyId/votes
GET /stories/:storyId/votes
GET /stories/:storyId/votes/:voteId
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
replace integration test (currently story_routes_spec.js) with high level feature test
Details in the feature test:
https://github.com/AgileVentures/AsyncVoter/blob/master/features/list_ongoing_vote.feature
Currently we are using env to set environment variables before running RSpec unit tests and Cucumber tests. The env command doesn't work smoothly for windows users. Using a package that enables setting environment variables cross-platform would be very helpful. See notes about cross-env here : https://www.npmjs.com/package/cross-env
Feature: Counting votes on story
As a developer
I want to see the number of votes cast on a story and by whom
and .env-sample and whatever
move to standard express structure ...
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.)
or we can't get data
We probably need to put in better error handling - rather than just crashing the server
or at least have lots of examples ...
Is there a way to have the code indented/formatted consistently whenever it is committed to the repo?
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
.
As not to interfere with existing database records/documents - a test database should be used.
For example: asyncvoter-test
rather than asyncvoter
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
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
Feature: Only active stories may be voted upon
As a developer, if I cast a vote on an inactive story
Then the vote is rejected
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.
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.
Make the server port configurable to ensure that the tests and the server do not run in the same port
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
general filtering wasn't working so restricted it to just state=active
either rename it, or get the general filtering working
Readme still says:
To run all the tests execute
npm run spec
Instead of
npm test
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.
Acceptance criteria:
Validators on all input forms
Validators on all search forms
need a CONTRIBUTING.md - add some install stuff to docs/
As a Bot
When I can a User vote
I should be informed if the vote ended
we all need to review each others PRs
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
we should get the available API routes
automated and showing up on pull requests
Because the application crash with the latest mongodb version
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.