a681758a9704263b46aaae679ef2cd7aa3f7229e
[motion2.git] / server / api / team / team.model.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x63e3=['Fax','Mail','Openchannel','Sms','Voice','resolve','all','lodash','./team.attributes','get','then','map','setDataValue','channel','teams','Chat'];(function(_0x2132a3,_0x4639e9){var _0x21890c=function(_0x34b73d){while(--_0x34b73d){_0x2132a3['push'](_0x2132a3['shift']());}};_0x21890c(++_0x4639e9);}(_0x63e3,0x157));var _0x363e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x63e3[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x363e('0x0'));var attributes=require(_0x363e('0x1'));function getQueuesByChannel(_0xa7d11,_0x56b153){var _0x4e39fe=_0x363e('0x2')+_0x56b153+'Queues';return _0xa7d11[_0x4e39fe]()[_0x363e('0x3')](function(_0xa3cb6a){return _[_0x363e('0x4')](_0xa3cb6a,function(_0xf4b79f){_0xf4b79f[_0x363e('0x5')](_0x363e('0x6'),_0x56b153);return _0xf4b79f;});})['catch'](function(_0x9f934){throw _0x9f934;});}module['exports']=function(_0x27e65b){return _0x27e65b['define']('Team',attributes,{'tableName':_0x363e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x10c432=this;var _0x4a316d=[_0x363e('0x8'),_0x363e('0x9'),_0x363e('0xa'),_0x363e('0xb'),_0x363e('0xc'),_0x363e('0xd'),'Whatsapp'];return Promise[_0x363e('0xe')]()[_0x363e('0x3')](function(){var _0x591ed0=_[_0x363e('0x4')](_0x4a316d,function(_0x127c73){return getQueuesByChannel(_0x10c432,_0x127c73);});return Promise[_0x363e('0xf')](_0x591ed0);})['catch'](function(_0x30fbcc){throw _0x30fbcc;});}}});};