Built motion from commit 52c8a02d.|2.6.29
[motion2.git] / server / api / interval / interval.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 _0x008f=['../../components/extensions/rewrite','iftime','exports','define','Interval','rewrite','interval','string','getIntervals','then','map','ifTime','./interval.attributes'];(function(_0x9d679d,_0x4dd38a){var _0x3ce1dc=function(_0x2cbc68){while(--_0x2cbc68){_0x9d679d['push'](_0x9d679d['shift']());}};_0x3ce1dc(++_0x4dd38a);}(_0x008f,0x1c6));var _0xf008=function(_0x2bbb49,_0x13bc74){_0x2bbb49=_0x2bbb49-0x0;var _0x276690=_0x008f[_0x2bbb49];return _0x276690;};'use strict';var attributes=require(_0xf008('0x0'));var extensions=require(_0xf008('0x1'));var iftime=require('../../utils/iftime')[_0xf008('0x2')];module[_0xf008('0x3')]=function(_0x4174b5){return _0x4174b5[_0xf008('0x4')](_0xf008('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c758c){extensions[_0xf008('0x6')](_0x4174b5,_0x3c758c);},'afterBulkCreate':function(_0x34d1cc,_0x26b8fa,_0x2209fd){_0x2209fd();extensions[_0xf008('0x6')](_0x4174b5,_0x34d1cc[0x0]);},'afterUpdate':function(_0x375c2c){extensions[_0xf008('0x6')](_0x4174b5,_0x375c2c);},'afterDestroy':function(_0x1d45be){extensions[_0xf008('0x6')](_0x4174b5,_0x1d45be);}},'instanceMethods':{'ifTime':function(_0x32d81d=undefined,_0x3408ad=new Date()){if(typeof this[_0xf008('0x7')]===_0xf008('0x8')){return iftime(this['interval'],_0x32d81d,_0x3408ad);}else{return this[_0xf008('0x9')]()[_0xf008('0xa')](function(_0x3940f7){return Promise['all'](_0x3940f7[_0xf008('0xb')](function(_0x21b10e){return _0x21b10e[_0xf008('0xc')](_0x32d81d,_0x3408ad);}));})[_0xf008('0xa')](function(_0x7c53d1){return _0x7c53d1['reduce'](function(_0x36c22e,_0x49e574){return _0x36c22e||_0x49e574;},![]);});}}}});};