598ac7540f72b28cb3e802a57467313bdc14313c
[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 _0xe68b=['map','setDataValue','channel','catch','exports','Team','teams','Fax','Voice','Whatsapp','then','all','./team.attributes','get','Queues'];(function(_0x24f107,_0x3c6c88){var _0x5116ab=function(_0x2b4985){while(--_0x2b4985){_0x24f107['push'](_0x24f107['shift']());}};_0x5116ab(++_0x3c6c88);}(_0xe68b,0x165));var _0xbe68=function(_0x30bc1f,_0xaa2a4a){_0x30bc1f=_0x30bc1f-0x0;var _0x176de3=_0xe68b[_0x30bc1f];return _0x176de3;};'use strict';var _=require('lodash');var attributes=require(_0xbe68('0x0'));function getQueuesByChannel(_0x3fd072,_0x5d4c93){var _0x2c54ba=_0xbe68('0x1')+_0x5d4c93+_0xbe68('0x2');return _0x3fd072[_0x2c54ba]()['then'](function(_0x4c928f){return _[_0xbe68('0x3')](_0x4c928f,function(_0x2fcea8){_0x2fcea8[_0xbe68('0x4')](_0xbe68('0x5'),_0x5d4c93);return _0x2fcea8;});})[_0xbe68('0x6')](function(_0x3c9a5f){throw _0x3c9a5f;});}module[_0xbe68('0x7')]=function(_0x39df4d){return _0x39df4d['define'](_0xbe68('0x8'),attributes,{'tableName':_0xbe68('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1a8d8b=this;var _0xa0b006=['Chat',_0xbe68('0xa'),'Mail','Openchannel','Sms',_0xbe68('0xb'),_0xbe68('0xc')];return Promise['resolve']()[_0xbe68('0xd')](function(){var _0x195caf=_[_0xbe68('0x3')](_0xa0b006,function(_0x272c3a){return getQueuesByChannel(_0x1a8d8b,_0x272c3a);});return Promise[_0xbe68('0xe')](_0x195caf);})['catch'](function(_0x16f738){throw _0x16f738;});}}});};