 Q = require 'q'
 logger = require 'winston'
 
-ObjectId = require('mongoose').Types.ObjectId
-monq = require("monq")
-
-config = require("../config/config")
-config.mongo = config.get('mongo')
-client = monq(config.mongo.url, safe: true)
-
-queue = client.queue("transactions")
 authorisation = require './authorisation'
 authMiddleware = require '../middleware/authorisation'
 


#####################################################
# Creates a new Task
# Create the new queue objects for the created task #
#####################################################
exports.addTask = ->


        utils.logAndSetResponse this, 'bad request', 'Cannot queue task as there are transactions with disabled or deleted channels', 'info'
        return

      transactionsArr.push tid: tid for tid in transactions.tids
      taskObject.transactions = transactionsArr

      task = new Task(taskObject)
      result = yield Q.ninvoke(task, 'save')

      # All ok! So set the result
      utils.logAndSetResponse this, 'created', "User #{this.authenticated.email} created task with id #{task.id}", 'info'
