Built motion from commit bab6f49e.|2.6.17
[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 _0xf0b8=['Interval','rewrite','interval','all','map','ifTime','then','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports'];(function(_0x307cec,_0x1cf922){var _0x285c73=function(_0x2602e7){while(--_0x2602e7){_0x307cec['push'](_0x307cec['shift']());}};_0x285c73(++_0x1cf922);}(_0xf0b8,0x187));var _0x8f0b=function(_0x5aaf31,_0x3cc61f){_0x5aaf31=_0x5aaf31-0x0;var _0x4e0132=_0xf0b8[_0x5aaf31];return _0x4e0132;};'use strict';var attributes=require(_0x8f0b('0x0'));var extensions=require(_0x8f0b('0x1'));var iftime=require(_0x8f0b('0x2'))[_0x8f0b('0x3')];module[_0x8f0b('0x4')]=function(_0x302f20){return _0x302f20['define'](_0x8f0b('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d4000){extensions[_0x8f0b('0x6')](_0x302f20,_0x3d4000);},'afterBulkCreate':function(_0x351b73,_0x44e1f8,_0x41b090){_0x41b090();extensions[_0x8f0b('0x6')](_0x302f20,_0x351b73[0x0]);},'afterUpdate':function(_0x94a256){extensions[_0x8f0b('0x6')](_0x302f20,_0x94a256);},'afterDestroy':function(_0x5ce84c){extensions[_0x8f0b('0x6')](_0x302f20,_0x5ce84c);}},'instanceMethods':{'ifTime':function(_0x46202d=undefined,_0x184042=new Date()){if(typeof this[_0x8f0b('0x7')]==='string'){return iftime(this[_0x8f0b('0x7')],_0x46202d,_0x184042);}else{return this['getIntervals']()['then'](function(_0x45ba90){return Promise[_0x8f0b('0x8')](_0x45ba90[_0x8f0b('0x9')](function(_0x55d13c){return _0x55d13c[_0x8f0b('0xa')](_0x46202d,_0x184042);}));})[_0x8f0b('0xb')](function(_0x211a84){return _0x211a84['reduce'](function(_0x58b0b4,_0x30e0b3){return _0x58b0b4||_0x30e0b3;},![]);});}}}});};