3db139b94c7580a4a867c002aa9139adcae14060
[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 _0x7afd=['Whatsapp','resolve','catch','./team.attributes','get','Queues','then','map','channel','exports','define','Team','teams','Chat','Fax','Sms'];(function(_0x2cb169,_0x38ec0a){var _0x54c758=function(_0x3f3cf4){while(--_0x3f3cf4){_0x2cb169['push'](_0x2cb169['shift']());}};_0x54c758(++_0x38ec0a);}(_0x7afd,0x103));var _0xd7af=function(_0x10e1ce,_0x1f28eb){_0x10e1ce=_0x10e1ce-0x0;var _0x5be2ea=_0x7afd[_0x10e1ce];return _0x5be2ea;};'use strict';var _=require('lodash');var attributes=require(_0xd7af('0x0'));function getQueuesByChannel(_0x28ae8f,_0x46abe7){var _0x1b5025=_0xd7af('0x1')+_0x46abe7+_0xd7af('0x2');return _0x28ae8f[_0x1b5025]()[_0xd7af('0x3')](function(_0x4279fc){return _[_0xd7af('0x4')](_0x4279fc,function(_0x12dab8){_0x12dab8['setDataValue'](_0xd7af('0x5'),_0x46abe7);return _0x12dab8;});})['catch'](function(_0x4a518b){throw _0x4a518b;});}module[_0xd7af('0x6')]=function(_0x3fbd3d){return _0x3fbd3d[_0xd7af('0x7')](_0xd7af('0x8'),attributes,{'tableName':_0xd7af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xa8631b=this;var _0x2d69bb=[_0xd7af('0xa'),_0xd7af('0xb'),'Mail','Openchannel',_0xd7af('0xc'),'Voice',_0xd7af('0xd')];return Promise[_0xd7af('0xe')]()['then'](function(){var _0x1cf31f=_[_0xd7af('0x4')](_0x2d69bb,function(_0x5c1f9c){return getQueuesByChannel(_0xa8631b,_0x5c1f9c);});return Promise['all'](_0x1cf31f);})[_0xd7af('0xf')](function(_0x111966){throw _0x111966;});}}});};