Built motion from commit bab6f49e.|2.6.17
[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 _0xa1f8=['Chat','Mail','Openchannel','Sms','Voice','resolve','all','lodash','./team.attributes','get','Queues','then','map','channel','catch','exports','define','Team','teams'];(function(_0xd66436,_0x105fb0){var _0x474ee4=function(_0x52ea5a){while(--_0x52ea5a){_0xd66436['push'](_0xd66436['shift']());}};_0x474ee4(++_0x105fb0);}(_0xa1f8,0xc5));var _0x8a1f=function(_0x8e3507,_0x7c734c){_0x8e3507=_0x8e3507-0x0;var _0x48c52b=_0xa1f8[_0x8e3507];return _0x48c52b;};'use strict';var _=require(_0x8a1f('0x0'));var attributes=require(_0x8a1f('0x1'));function getQueuesByChannel(_0x2c45a8,_0x218a6c){var _0x2f2ae5=_0x8a1f('0x2')+_0x218a6c+_0x8a1f('0x3');return _0x2c45a8[_0x2f2ae5]()[_0x8a1f('0x4')](function(_0x4272ef){return _[_0x8a1f('0x5')](_0x4272ef,function(_0x5dd145){_0x5dd145['setDataValue'](_0x8a1f('0x6'),_0x218a6c);return _0x5dd145;});})[_0x8a1f('0x7')](function(_0x4a6735){throw _0x4a6735;});}module[_0x8a1f('0x8')]=function(_0x17cd7d){return _0x17cd7d[_0x8a1f('0x9')](_0x8a1f('0xa'),attributes,{'tableName':_0x8a1f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3d5c94=this;var _0x5b74d6=[_0x8a1f('0xc'),'Fax',_0x8a1f('0xd'),_0x8a1f('0xe'),_0x8a1f('0xf'),_0x8a1f('0x10'),'Whatsapp'];return Promise[_0x8a1f('0x11')]()[_0x8a1f('0x4')](function(){var _0x21375d=_['map'](_0x5b74d6,function(_0x59510e){return getQueuesByChannel(_0x3d5c94,_0x59510e);});return Promise[_0x8a1f('0x12')](_0x21375d);})[_0x8a1f('0x7')](function(_0x4b1543){throw _0x4b1543;});}}});};