"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.notificationPlatformsCredentialsRepository = void 0;

var _lodash = _interopRequireDefault(require("lodash"));

var _repository = require("./repository");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

class NotificationPlatformsCredentialsRepository extends (0, _repository.repository)({
  tableName: 'notificationPlatformsCredentials',
  primaryColumnName: 'id'
}) {
  async get(userId) {
    const credentials = await this.find({
      userId: userId
    });
    return (0, _lodash.default)(credentials).groupBy(value => value.platformName).mapValues(value => (0, _lodash.default)(value).keyBy(value => value.name).mapValues(value => value.value).value()).value();
  }

}

const notificationPlatformsCredentialsRepository = new NotificationPlatformsCredentialsRepository();
exports.notificationPlatformsCredentialsRepository = notificationPlatformsCredentialsRepository;
//# sourceMappingURL=notificationPlatformsCredentials.js.map