133018c34805e54df535f12e6c2a7c5c994314a4
[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 _0xa2fe=['Sms','Voice','Whatsapp','resolve','all','catch','lodash','./team.attributes','get','then','map','setDataValue','channel','exports','Team','teams','Chat','Fax','Openchannel'];(function(_0x56dfac,_0x360da0){var _0x4690fd=function(_0xd8f2fd){while(--_0xd8f2fd){_0x56dfac['push'](_0x56dfac['shift']());}};_0x4690fd(++_0x360da0);}(_0xa2fe,0xea));var _0xea2f=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xa2fe[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0xea2f('0x0'));var attributes=require(_0xea2f('0x1'));function getQueuesByChannel(_0x269a82,_0x5d03b4){var _0x3272cf=_0xea2f('0x2')+_0x5d03b4+'Queues';return _0x269a82[_0x3272cf]()[_0xea2f('0x3')](function(_0x104bf2){return _[_0xea2f('0x4')](_0x104bf2,function(_0x28de55){_0x28de55[_0xea2f('0x5')](_0xea2f('0x6'),_0x5d03b4);return _0x28de55;});})['catch'](function(_0xa5940a){throw _0xa5940a;});}module[_0xea2f('0x7')]=function(_0x4ea210){return _0x4ea210['define'](_0xea2f('0x8'),attributes,{'tableName':_0xea2f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3b472f=this;var _0x23b641=[_0xea2f('0xa'),_0xea2f('0xb'),'Mail',_0xea2f('0xc'),_0xea2f('0xd'),_0xea2f('0xe'),_0xea2f('0xf')];return Promise[_0xea2f('0x10')]()[_0xea2f('0x3')](function(){var _0x5388f2=_[_0xea2f('0x4')](_0x23b641,function(_0x442e96){return getQueuesByChannel(_0x3b472f,_0x442e96);});return Promise[_0xea2f('0x11')](_0x5388f2);})[_0xea2f('0x12')](function(_0x3ad44e){throw _0x3ad44e;});}}});};