'use strict';

const connectionRepository = require('./repository');

/**
 * @class ConnectionService
 */
class ConnectionService {
  /**
   * @constructor ConnectionService
   */
  constructor() {}

  /**
   * @method create
   */
  create(options) {
    return connectionRepository.create(options);
  }

  /**
   * @method list
   */
  list() {
    return connectionRepository.list();
  }

  /**
   * @method delete
   * @param {String} id - id of the connection to delete
   */
  delete(id) {
    return connectionRepository.delete(id);
  }
}

/**
 * @exports
 */
module.exports = new ConnectionService();

@@ -8,16 +8,92 @@
 rict';%0A%0A
+const Promise = require('bluebird');%0A%0Aconst errors = require('lib/errors');%0A
 const co
@@ -138,16 +138,16 @@
 tory');%0A
-
 %0A/**%0A * 
@@ -336,43 +336,653 @@
 urn 
-connectionRepository.create(options
+new Promise((resolve, reject) =%3E %7B%0A      if (!options) return reject(new errors.InvalidArugmentError('options is required'));%0A      if (!options.name) return reject(new errors.InvalidArugmentError('options.name is required'));%0A      if (!options.databaseName) return reject(new errors.InvalidArugmentError('options.databaseName is required'));%0A      if (!options.host) return reject(new errors.InvalidArugmentError('options.host is required'));%0A      if (!options.port) return reject(new errors.InvalidArugmentError('options.port is required'));%0A%0A      return connectionRepository.create(options)%0A      .then(resolve)%0A      .catch(reject);%0A    %7D
 );%0A 

check for args at service level