0b7362a4034f9b0f2c423eab1189801362d534c5
[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 _0x6b7f=['Whatsapp','resolve','catch','lodash','./team.attributes','get','Queues','then','map','setDataValue','exports','define','teams','Chat','Fax','Openchannel','Sms','Voice'];(function(_0x504fa8,_0x448235){var _0x2abdf3=function(_0x2a3906){while(--_0x2a3906){_0x504fa8['push'](_0x504fa8['shift']());}};_0x2abdf3(++_0x448235);}(_0x6b7f,0x6f));var _0xf6b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b7f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6b7('0x0'));var attributes=require(_0xf6b7('0x1'));function getQueuesByChannel(_0x2692cf,_0x3379b0){var _0x52707e=_0xf6b7('0x2')+_0x3379b0+_0xf6b7('0x3');return _0x2692cf[_0x52707e]()[_0xf6b7('0x4')](function(_0x3516c2){return _[_0xf6b7('0x5')](_0x3516c2,function(_0x2ae708){_0x2ae708[_0xf6b7('0x6')]('channel',_0x3379b0);return _0x2ae708;});})['catch'](function(_0x56890c){throw _0x56890c;});}module[_0xf6b7('0x7')]=function(_0x4a0c70){return _0x4a0c70[_0xf6b7('0x8')]('Team',attributes,{'tableName':_0xf6b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x514402=this;var _0x2db7fb=[_0xf6b7('0xa'),_0xf6b7('0xb'),'Mail',_0xf6b7('0xc'),_0xf6b7('0xd'),_0xf6b7('0xe'),_0xf6b7('0xf')];return Promise[_0xf6b7('0x10')]()[_0xf6b7('0x4')](function(){var _0x390cca=_[_0xf6b7('0x5')](_0x2db7fb,function(_0x56acea){return getQueuesByChannel(_0x514402,_0x56acea);});return Promise['all'](_0x390cca);})[_0xf6b7('0x11')](function(_0x3e6744){throw _0x3e6744;});}}});};