2491ec469f945a1106d5997ec203a07bde264616
[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 _0x5d15=['Mail','Voice','Whatsapp','resolve','then','all','catch','lodash','./team.attributes','get','Queues','map','setDataValue','channel','define','Team','teams','Chat','Fax'];(function(_0x4fc0f4,_0x6bdfde){var _0x1af64c=function(_0x1d324d){while(--_0x1d324d){_0x4fc0f4['push'](_0x4fc0f4['shift']());}};_0x1af64c(++_0x6bdfde);}(_0x5d15,0x183));var _0x55d1=function(_0x5ad07c,_0x324dcd){_0x5ad07c=_0x5ad07c-0x0;var _0x204bae=_0x5d15[_0x5ad07c];return _0x204bae;};'use strict';var _=require(_0x55d1('0x0'));var attributes=require(_0x55d1('0x1'));function getQueuesByChannel(_0x497c2d,_0x343fc7){var _0x241d2e=_0x55d1('0x2')+_0x343fc7+_0x55d1('0x3');return _0x497c2d[_0x241d2e]()['then'](function(_0x4a0f59){return _[_0x55d1('0x4')](_0x4a0f59,function(_0x43be9a){_0x43be9a[_0x55d1('0x5')](_0x55d1('0x6'),_0x343fc7);return _0x43be9a;});})['catch'](function(_0x3f1906){throw _0x3f1906;});}module['exports']=function(_0x1768d2){return _0x1768d2[_0x55d1('0x7')](_0x55d1('0x8'),attributes,{'tableName':_0x55d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x161b2b=this;var _0x4c9750=[_0x55d1('0xa'),_0x55d1('0xb'),_0x55d1('0xc'),'Openchannel','Sms',_0x55d1('0xd'),_0x55d1('0xe')];return Promise[_0x55d1('0xf')]()[_0x55d1('0x10')](function(){var _0x33e6bc=_[_0x55d1('0x4')](_0x4c9750,function(_0x39e738){return getQueuesByChannel(_0x161b2b,_0x39e738);});return Promise[_0x55d1('0x11')](_0x33e6bc);})[_0x55d1('0x12')](function(_0x47fd56){throw _0x47fd56;});}}});};