0273d2b70a8843069222a8790b39af0b4afb3226
[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 _0x6c46=['map','setDataValue','channel','exports','Team','teams','Chat','Fax','Mail','Sms','Voice','Whatsapp','all','get','then'];(function(_0x35f978,_0x1b898a){var _0x36988a=function(_0x2e37ca){while(--_0x2e37ca){_0x35f978['push'](_0x35f978['shift']());}};_0x36988a(++_0x1b898a);}(_0x6c46,0x94));var _0x66c4=function(_0x2e292c,_0x5db982){_0x2e292c=_0x2e292c-0x0;var _0x2f7e3e=_0x6c46[_0x2e292c];return _0x2f7e3e;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0x5b0303,_0x3844ab){var _0x4723d8=_0x66c4('0x0')+_0x3844ab+'Queues';return _0x5b0303[_0x4723d8]()[_0x66c4('0x1')](function(_0x495fa0){return _[_0x66c4('0x2')](_0x495fa0,function(_0x4f1227){_0x4f1227[_0x66c4('0x3')](_0x66c4('0x4'),_0x3844ab);return _0x4f1227;});})['catch'](function(_0x22996a){throw _0x22996a;});}module[_0x66c4('0x5')]=function(_0x22a3ab){return _0x22a3ab['define'](_0x66c4('0x6'),attributes,{'tableName':_0x66c4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x404270=this;var _0x2c6736=[_0x66c4('0x8'),_0x66c4('0x9'),_0x66c4('0xa'),'Openchannel',_0x66c4('0xb'),_0x66c4('0xc'),_0x66c4('0xd')];return Promise['resolve']()[_0x66c4('0x1')](function(){var _0x2a0f09=_['map'](_0x2c6736,function(_0x15b29a){return getQueuesByChannel(_0x404270,_0x15b29a);});return Promise[_0x66c4('0xe')](_0x2a0f09);})['catch'](function(_0x29f987){throw _0x29f987;});}}});};