2e766fa4cafe0f59ecc5cf71c7e14e7f111b3e0f
[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 _0x2e94=['setDataValue','channel','catch','exports','Team','teams','Chat','Fax','Mail','Sms','Whatsapp','resolve','all','lodash','./team.attributes','get','then','map'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x2e94,0xd3));var _0x42e9=function(_0x5f2435,_0xdd0fc){_0x5f2435=_0x5f2435-0x0;var _0x5378e1=_0x2e94[_0x5f2435];return _0x5378e1;};'use strict';var _=require(_0x42e9('0x0'));var attributes=require(_0x42e9('0x1'));function getQueuesByChannel(_0x261161,_0x4b0059){var _0x235921=_0x42e9('0x2')+_0x4b0059+'Queues';return _0x261161[_0x235921]()[_0x42e9('0x3')](function(_0x2c0588){return _[_0x42e9('0x4')](_0x2c0588,function(_0x189571){_0x189571[_0x42e9('0x5')](_0x42e9('0x6'),_0x4b0059);return _0x189571;});})[_0x42e9('0x7')](function(_0x32cb7a){throw _0x32cb7a;});}module[_0x42e9('0x8')]=function(_0x143ff8){return _0x143ff8['define'](_0x42e9('0x9'),attributes,{'tableName':_0x42e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x218893=this;var _0x4c7ab4=[_0x42e9('0xb'),_0x42e9('0xc'),_0x42e9('0xd'),'Openchannel',_0x42e9('0xe'),'Voice',_0x42e9('0xf')];return Promise[_0x42e9('0x10')]()['then'](function(){var _0x40ec60=_[_0x42e9('0x4')](_0x4c7ab4,function(_0x32ef9e){return getQueuesByChannel(_0x218893,_0x32ef9e);});return Promise[_0x42e9('0x11')](_0x40ec60);})[_0x42e9('0x7')](function(_0x57eb92){throw _0x57eb92;});}}});};