b68104534e9a5d3cf0571ffa4e8c320c6e709bff
[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 _0x2e80=['all','map','reduce','./interval.attributes','../../utils/iftime','exports','define','Interval','rewrite','interval','string','then'];(function(_0x299028,_0x4d7e9f){var _0x12154e=function(_0x558d18){while(--_0x558d18){_0x299028['push'](_0x299028['shift']());}};_0x12154e(++_0x4d7e9f);}(_0x2e80,0x177));var _0x02e8=function(_0x54f7c0,_0x27af83){_0x54f7c0=_0x54f7c0-0x0;var _0x245d03=_0x2e80[_0x54f7c0];return _0x245d03;};'use strict';var attributes=require(_0x02e8('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x02e8('0x1'))['iftime'];module[_0x02e8('0x2')]=function(_0x503ffa){return _0x503ffa[_0x02e8('0x3')](_0x02e8('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b4428){extensions['rewrite'](_0x503ffa,_0x3b4428);},'afterBulkCreate':function(_0x51f7f9,_0x47ca05,_0x218235){_0x218235();extensions['rewrite'](_0x503ffa,_0x51f7f9[0x0]);},'afterUpdate':function(_0x228104){extensions[_0x02e8('0x5')](_0x503ffa,_0x228104);},'afterDestroy':function(_0x50ab77){extensions[_0x02e8('0x5')](_0x503ffa,_0x50ab77);}},'instanceMethods':{'ifTime':function(_0x39817f=undefined,_0x3fb969=new Date()){if(typeof this[_0x02e8('0x6')]===_0x02e8('0x7')){return iftime(this[_0x02e8('0x6')],_0x39817f,_0x3fb969);}else{return this['getIntervals']()[_0x02e8('0x8')](function(_0x42a849){return Promise[_0x02e8('0x9')](_0x42a849[_0x02e8('0xa')](function(_0x5e4dd2){return _0x5e4dd2['ifTime'](_0x39817f,_0x3fb969);}));})[_0x02e8('0x8')](function(_0x3b3e4c){return _0x3b3e4c[_0x02e8('0xb')](function(_0x99e573,_0x48a8d3){return _0x99e573||_0x48a8d3;},![]);});}}}});};