Skip to content

Instantly share code, notes, and snippets.

@ahdinosaur
Last active August 29, 2015 14:07
Show Gist options
  • Save ahdinosaur/f21425817534dced9272 to your computer and use it in GitHub Desktop.
Save ahdinosaur/f21425817534dced9272 to your computer and use it in GitHub Desktop.
cobudget API design

agent

  • string name
  • hasMany rounds
  • hasMany sponsored buckets
  • hasMany contributions

group (agent)

  • hasMany memberships
  • hasMany rounds

person (agent)

  • string email
  • string password
  • hasMany memberships

membership

  • belongsTo group
  • belongsTo person
  • isAdmin boolean

round

  • string name
  • string description
  • belongsTo group
  • hasMany buckets
  • hasMany allocations
  • hasMany fixedCosts
  • datetime startsAt
  • datetime endsAt

fixedCost

  • string name
  • string description
  • decimal amount

bucket

  • string name
  • string description
  • belongsTo sponsor agent
  • belongsTo round
  • hasMany contributions
  • string currency
  • decimal max
  • decimal min
  • decimal target
  • decimal current

contribution

  • belongsTo contributor agent
  • belongsTo bucket
  • string currency
  • decimal amount

allocation

  • belongsTo round
  • belongsTo allocatee agent
  • string currency
  • decimal amount

example group with related objects:

id: 1
name: Enspiral Services
hosted:
  - id: 5
    name: Fund CoBudget Development
    description: we are awesome and stuff :)
    sponsor:
      id: 2
    currency: NZD
    min: 0
    target: 500
    max: 1000 
    current: 23.47
    contributions:
      - contributor:
          id: 3
        currency: NZD
        amount: 13.37
      - contributor:
          id: 4
        currency: NZD
        amount: 10.1
members
  - id: 2
    name: Derek
    sponsored:
      id: 5
  - id: 3
    name: Mikey
    allocations:
      - allocator:
          id: 1
        amount: 50
        currency: NZD
  - id: 4
    name: Jon
    allocations:
      - allocator:
          id: 1
        amount: 150
        currency: NZD
rounds:
  - name: December Funding Round!
    description: check out our beautiful process
    buckets:
      - id: 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment