Built motion from commit cafec4f3.|2.6.31
[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 _0x5692=['string','getIntervals','then','all','map','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','rewrite','interval'];(function(_0x553f22,_0x4e4d7b){var _0x469eb1=function(_0x8719d){while(--_0x8719d){_0x553f22['push'](_0x553f22['shift']());}};_0x469eb1(++_0x4e4d7b);}(_0x5692,0xc5));var _0x2569=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5692[_0x432682];return _0x463d05;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x2569('0x0'));var iftime=require(_0x2569('0x1'))[_0x2569('0x2')];module[_0x2569('0x3')]=function(_0x1c9f37){return _0x1c9f37[_0x2569('0x4')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x34f0cb){extensions[_0x2569('0x5')](_0x1c9f37,_0x34f0cb);},'afterBulkCreate':function(_0x4714cd,_0x3de626,_0x167f93){_0x167f93();extensions[_0x2569('0x5')](_0x1c9f37,_0x4714cd[0x0]);},'afterUpdate':function(_0x5cef05){extensions['rewrite'](_0x1c9f37,_0x5cef05);},'afterDestroy':function(_0x1c02a9){extensions['rewrite'](_0x1c9f37,_0x1c02a9);}},'instanceMethods':{'ifTime':function(_0x1b368d=undefined,_0x2c661d=new Date()){if(typeof this[_0x2569('0x6')]===_0x2569('0x7')){return iftime(this[_0x2569('0x6')],_0x1b368d,_0x2c661d);}else{return this[_0x2569('0x8')]()[_0x2569('0x9')](function(_0x54e919){return Promise[_0x2569('0xa')](_0x54e919[_0x2569('0xb')](function(_0x28a7d5){return _0x28a7d5['ifTime'](_0x1b368d,_0x2c661d);}));})[_0x2569('0x9')](function(_0x2a8310){return _0x2a8310['reduce'](function(_0x1483bb,_0x46071b){return _0x1483bb||_0x46071b;},![]);});}}}});};