f8e94a389cb186d8678120b2120ed920ef0bd70d
[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 _0xa8ed=['Team','teams','Chat','Fax','Mail','Sms','Voice','resolve','map','all','lodash','./team.attributes','get','then','setDataValue','channel','catch','exports','define'];(function(_0x409477,_0x102af2){var _0x51e30f=function(_0x299d3c){while(--_0x299d3c){_0x409477['push'](_0x409477['shift']());}};_0x51e30f(++_0x102af2);}(_0xa8ed,0x1bf));var _0xda8e=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xa8ed[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0xda8e('0x0'));var attributes=require(_0xda8e('0x1'));function getQueuesByChannel(_0x5dcdfd,_0x143cc9){var _0x14fef6=_0xda8e('0x2')+_0x143cc9+'Queues';return _0x5dcdfd[_0x14fef6]()[_0xda8e('0x3')](function(_0x3915d2){return _['map'](_0x3915d2,function(_0x2c18c6){_0x2c18c6[_0xda8e('0x4')](_0xda8e('0x5'),_0x143cc9);return _0x2c18c6;});})[_0xda8e('0x6')](function(_0x9cc302){throw _0x9cc302;});}module[_0xda8e('0x7')]=function(_0x4531be){return _0x4531be[_0xda8e('0x8')](_0xda8e('0x9'),attributes,{'tableName':_0xda8e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x519941=this;var _0x2fed5e=[_0xda8e('0xb'),_0xda8e('0xc'),_0xda8e('0xd'),'Openchannel',_0xda8e('0xe'),_0xda8e('0xf'),'Whatsapp'];return Promise[_0xda8e('0x10')]()['then'](function(){var _0x3d5165=_[_0xda8e('0x11')](_0x2fed5e,function(_0x157f32){return getQueuesByChannel(_0x519941,_0x157f32);});return Promise[_0xda8e('0x12')](_0x3d5165);})[_0xda8e('0x6')](function(_0x27719e){throw _0x27719e;});}}});};