628c1be3bf14bab16f537127f363bd0f2eacfbc4
[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 _0x9685=['Team','teams','Chat','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','lodash','./team.attributes','Queues','then','map','setDataValue','channel','catch','exports','define'];(function(_0x242514,_0x562b9a){var _0x292c28=function(_0x36f8e4){while(--_0x36f8e4){_0x242514['push'](_0x242514['shift']());}};_0x292c28(++_0x562b9a);}(_0x9685,0x172));var _0x5968=function(_0x1c0018,_0x4926a7){_0x1c0018=_0x1c0018-0x0;var _0x4a8d3e=_0x9685[_0x1c0018];return _0x4a8d3e;};'use strict';var _=require(_0x5968('0x0'));var attributes=require(_0x5968('0x1'));function getQueuesByChannel(_0x5928ab,_0x4db2ee){var _0x27d8a9='get'+_0x4db2ee+_0x5968('0x2');return _0x5928ab[_0x27d8a9]()[_0x5968('0x3')](function(_0x11105c){return _[_0x5968('0x4')](_0x11105c,function(_0x48bc5c){_0x48bc5c[_0x5968('0x5')](_0x5968('0x6'),_0x4db2ee);return _0x48bc5c;});})[_0x5968('0x7')](function(_0x3fb890){throw _0x3fb890;});}module[_0x5968('0x8')]=function(_0x5aa366){return _0x5aa366[_0x5968('0x9')](_0x5968('0xa'),attributes,{'tableName':_0x5968('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1ef811=this;var _0x2090cc=[_0x5968('0xc'),'Fax',_0x5968('0xd'),_0x5968('0xe'),_0x5968('0xf'),_0x5968('0x10'),_0x5968('0x11')];return Promise[_0x5968('0x12')]()['then'](function(){var _0x1323e6=_['map'](_0x2090cc,function(_0x5ead04){return getQueuesByChannel(_0x1ef811,_0x5ead04);});return Promise['all'](_0x1323e6);})['catch'](function(_0x107650){throw _0x107650;});}}});};