34b7782a8fe70888c8eaa72c1d39203f467d59ba
[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 _0x7ed2=['./interval.attributes','../../components/extensions/rewrite','iftime','exports','define','Interval','rewrite','interval','getIntervals','all','ifTime','reduce'];(function(_0xaf5471,_0x2b651c){var _0x5c4f41=function(_0x174f7f){while(--_0x174f7f){_0xaf5471['push'](_0xaf5471['shift']());}};_0x5c4f41(++_0x2b651c);}(_0x7ed2,0xb4));var _0x27ed=function(_0x100f69,_0x45a456){_0x100f69=_0x100f69-0x0;var _0x39d8c6=_0x7ed2[_0x100f69];return _0x39d8c6;};'use strict';var attributes=require(_0x27ed('0x0'));var extensions=require(_0x27ed('0x1'));var iftime=require('../../utils/iftime')[_0x27ed('0x2')];module[_0x27ed('0x3')]=function(_0x19b0fe){return _0x19b0fe[_0x27ed('0x4')](_0x27ed('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x45fe25){extensions[_0x27ed('0x6')](_0x19b0fe,_0x45fe25);},'afterBulkCreate':function(_0x250fef,_0x40c9f9,_0x3f749e){_0x3f749e();extensions[_0x27ed('0x6')](_0x19b0fe,_0x250fef[0x0]);},'afterUpdate':function(_0x1cc0c7){extensions[_0x27ed('0x6')](_0x19b0fe,_0x1cc0c7);},'afterDestroy':function(_0x1467ec){extensions[_0x27ed('0x6')](_0x19b0fe,_0x1467ec);}},'instanceMethods':{'ifTime':function(_0x1efbad=undefined,_0x11ca95=new Date()){if(typeof this['interval']==='string'){return iftime(this[_0x27ed('0x7')],_0x1efbad,_0x11ca95);}else{return this[_0x27ed('0x8')]()['then'](function(_0x4a781e){return Promise[_0x27ed('0x9')](_0x4a781e['map'](function(_0x562ba4){return _0x562ba4[_0x27ed('0xa')](_0x1efbad,_0x11ca95);}));})['then'](function(_0x440db9){return _0x440db9[_0x27ed('0xb')](function(_0x2aa339,_0x49175c){return _0x2aa339||_0x49175c;},![]);});}}}});};