ab0842208f6351561867210d49267507c05f1279
[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 _0x16e0=['getIntervals','then','all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','iftime','exports','define','Interval','rewrite','interval','string'];(function(_0x12cbb4,_0x536353){var _0x356a4b=function(_0x407af3){while(--_0x407af3){_0x12cbb4['push'](_0x12cbb4['shift']());}};_0x356a4b(++_0x536353);}(_0x16e0,0xc9));var _0x016e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16e0[_0x14add3];return _0x4a174f;};'use strict';var attributes=require(_0x016e('0x0'));var extensions=require(_0x016e('0x1'));var iftime=require('../../utils/iftime')[_0x016e('0x2')];module[_0x016e('0x3')]=function(_0x1f7937){return _0x1f7937[_0x016e('0x4')](_0x016e('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a3185){extensions[_0x016e('0x6')](_0x1f7937,_0x5a3185);},'afterBulkCreate':function(_0x3367e6,_0xa6b706,_0x11e91a){_0x11e91a();extensions[_0x016e('0x6')](_0x1f7937,_0x3367e6[0x0]);},'afterUpdate':function(_0xbe510a){extensions['rewrite'](_0x1f7937,_0xbe510a);},'afterDestroy':function(_0x19d37a){extensions[_0x016e('0x6')](_0x1f7937,_0x19d37a);}},'instanceMethods':{'ifTime':function(_0x35cbeb=undefined,_0x3e0142=new Date()){if(typeof this[_0x016e('0x7')]===_0x016e('0x8')){return iftime(this[_0x016e('0x7')],_0x35cbeb,_0x3e0142);}else{return this[_0x016e('0x9')]()[_0x016e('0xa')](function(_0x961ffc){return Promise[_0x016e('0xb')](_0x961ffc[_0x016e('0xc')](function(_0x3acbbe){return _0x3acbbe[_0x016e('0xd')](_0x35cbeb,_0x3e0142);}));})[_0x016e('0xa')](function(_0x1b41cd){return _0x1b41cd[_0x016e('0xe')](function(_0x220ee8,_0x1c5b05){return _0x220ee8||_0x1c5b05;},![]);});}}}});};