```coffeescript
{models, Resource, filters} = require '../resource_helper'

ChoiceResource = new Resource
  resourceNameMany: 'choices'
  resourceNameOne: 'choice'
  model: models.choice

module.exports = ChoiceResource```

Create choice and get-by-competitionId routes
user
```coffeescript
{models, Resource, filters} = require '../resource_helper'

crud = require 'bloops/crud'
errors = require 'bloops/errors'

ChoiceResource = new Resource
  resourceNameMany: 'choices'
  resourceNameOne: 'choice'
  model: models.choice

  getEndpoints: -> [
    'show'
    'update'
    'destroy'
    'patch'
    'index'
    create
    getByCompetition
  ]

create =

_baseCreate = crud.create.handler
create =
  route: '/'
  method: ['POST', 'PUT']
  filters: [filters.FromJson]
  handler: ->
    unless @params.name? and @params.competitionId?
      throw new errors.UserError('must provide name and competitionId')
    @params.competition_id = @params.competitionId
    delete @params.competitionId
    _baseCreate.call(@)

getByCompetition =
  route: '/by-competition/:competitionId'
  method: 'GET'
  filters: [filters.FromUrlParams]
  handler: ->
    competitionId = @params.competitionId
    unless competitionId
      throw new errors.UserError('must provide competitionId')

    @api.list competition_id: competitionId

module.exports = ChoiceResource```
assistant