85885db8d7207e10cca8834e02be88e799dbd83f
[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 _0x1ebd=['get','Queues','map','setDataValue','catch','exports','define','Team','teams','Chat','Mail','Sms','Voice','resolve','then','all','./team.attributes'];(function(_0x4b584e,_0x59e486){var _0x103564=function(_0x743c){while(--_0x743c){_0x4b584e['push'](_0x4b584e['shift']());}};_0x103564(++_0x59e486);}(_0x1ebd,0x1db));var _0xd1eb=function(_0x31ce92,_0x5d5a50){_0x31ce92=_0x31ce92-0x0;var _0x3478f6=_0x1ebd[_0x31ce92];return _0x3478f6;};'use strict';var _=require('lodash');var attributes=require(_0xd1eb('0x0'));function getQueuesByChannel(_0x42751c,_0x258555){var _0x1aad99=_0xd1eb('0x1')+_0x258555+_0xd1eb('0x2');return _0x42751c[_0x1aad99]()['then'](function(_0x489c8f){return _[_0xd1eb('0x3')](_0x489c8f,function(_0x48aa1e){_0x48aa1e[_0xd1eb('0x4')]('channel',_0x258555);return _0x48aa1e;});})[_0xd1eb('0x5')](function(_0x21fdc0){throw _0x21fdc0;});}module[_0xd1eb('0x6')]=function(_0x24e758){return _0x24e758[_0xd1eb('0x7')](_0xd1eb('0x8'),attributes,{'tableName':_0xd1eb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1036c0=this;var _0x428cac=[_0xd1eb('0xa'),'Fax',_0xd1eb('0xb'),'Openchannel',_0xd1eb('0xc'),_0xd1eb('0xd'),'Whatsapp'];return Promise[_0xd1eb('0xe')]()[_0xd1eb('0xf')](function(){var _0x590026=_[_0xd1eb('0x3')](_0x428cac,function(_0x4979ef){return getQueuesByChannel(_0x1036c0,_0x4979ef);});return Promise[_0xd1eb('0x10')](_0x590026);})[_0xd1eb('0x5')](function(_0x5e750){throw _0x5e750;});}}});};