052c1d2086e07a259dc66f8e42b333ff27ea643c
[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 _0x07cd=['Mail','Openchannel','Sms','resolve','all','lodash','get','Queues','then','map','channel','catch','exports','define','Team','Fax'];(function(_0x20b4bd,_0x313899){var _0x4677c0=function(_0x364cc0){while(--_0x364cc0){_0x20b4bd['push'](_0x20b4bd['shift']());}};_0x4677c0(++_0x313899);}(_0x07cd,0x115));var _0xd07c=function(_0x4c2623,_0x4838bb){_0x4c2623=_0x4c2623-0x0;var _0x2be431=_0x07cd[_0x4c2623];return _0x2be431;};'use strict';var _=require(_0xd07c('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x16f02c,_0x54c944){var _0x4cfe2c=_0xd07c('0x1')+_0x54c944+_0xd07c('0x2');return _0x16f02c[_0x4cfe2c]()[_0xd07c('0x3')](function(_0x587655){return _[_0xd07c('0x4')](_0x587655,function(_0x35c467){_0x35c467['setDataValue'](_0xd07c('0x5'),_0x54c944);return _0x35c467;});})[_0xd07c('0x6')](function(_0x1acdf1){throw _0x1acdf1;});}module[_0xd07c('0x7')]=function(_0x167f6a){return _0x167f6a[_0xd07c('0x8')](_0xd07c('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x23f32a=this;var _0x59271d=['Chat',_0xd07c('0xa'),_0xd07c('0xb'),_0xd07c('0xc'),_0xd07c('0xd'),'Voice','Whatsapp'];return Promise[_0xd07c('0xe')]()['then'](function(){var _0x5de9da=_[_0xd07c('0x4')](_0x59271d,function(_0x136ebd){return getQueuesByChannel(_0x23f32a,_0x136ebd);});return Promise[_0xd07c('0xf')](_0x5de9da);})['catch'](function(_0xecb5cd){throw _0xecb5cd;});}}});};