45f282279b6cf0d834bdc721cccac4126d543329
[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 _0x74fb=['Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','catch','exports','define','Team','teams','Chat','Fax','Openchannel'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x74fb,0x1e4));var _0xb74f=function(_0x5337b7,_0x20e927){_0x5337b7=_0x5337b7-0x0;var _0x813f10=_0x74fb[_0x5337b7];return _0x813f10;};'use strict';var _=require(_0xb74f('0x0'));var attributes=require(_0xb74f('0x1'));function getQueuesByChannel(_0x3755c7,_0x5e51bf){var _0xb56c87=_0xb74f('0x2')+_0x5e51bf+_0xb74f('0x3');return _0x3755c7[_0xb56c87]()[_0xb74f('0x4')](function(_0x2bd1d0){return _[_0xb74f('0x5')](_0x2bd1d0,function(_0x105ab9){_0x105ab9[_0xb74f('0x6')](_0xb74f('0x7'),_0x5e51bf);return _0x105ab9;});})[_0xb74f('0x8')](function(_0x284b15){throw _0x284b15;});}module[_0xb74f('0x9')]=function(_0x305f63){return _0x305f63[_0xb74f('0xa')](_0xb74f('0xb'),attributes,{'tableName':_0xb74f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x49d3ae=this;var _0x5ae7a7=[_0xb74f('0xd'),_0xb74f('0xe'),'Mail',_0xb74f('0xf'),'Sms',_0xb74f('0x10'),_0xb74f('0x11')];return Promise[_0xb74f('0x12')]()['then'](function(){var _0x8e2d28=_[_0xb74f('0x5')](_0x5ae7a7,function(_0x139501){return getQueuesByChannel(_0x49d3ae,_0x139501);});return Promise[_0xb74f('0x13')](_0x8e2d28);})[_0xb74f('0x8')](function(_0x2372c2){throw _0x2372c2;});}}});};