jcbantuelle/dominion-meteor

View on GitHub
lib/server/models/game_model.js

Summary

Maintainability
A
0 mins
Test Coverage
GameModel = class GameModel extends ReactiveDictModel {
  static data_source() {
    return Games
  }

  static insert(record) {
    let game_id = Random.id()
    TurnEvents[game_id] = new ReactiveDict()
    this.data_source().set(game_id, _.merge(record, {
      _id: game_id,
      trade_route_tokens: 0,
      log: [],
      turn_number: 1,
      extra_turns: []
    }))
    return game_id
  }
}