1c453e893b92e362682cfc82769a5b10b73adb0b
[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 _0x6acc=['../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','tools_intervals','rewrite','interval','string','then','map','ifTime','reduce','./interval.attributes'];(function(_0x5a4eee,_0x5ba6f6){var _0x54ae2a=function(_0x20b37c){while(--_0x20b37c){_0x5a4eee['push'](_0x5a4eee['shift']());}};_0x54ae2a(++_0x5ba6f6);}(_0x6acc,0xa7));var _0xc6ac=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x6acc[_0x2dadb9];return _0x2f0097;};'use strict';var attributes=require(_0xc6ac('0x0'));var extensions=require(_0xc6ac('0x1'));var iftime=require(_0xc6ac('0x2'))[_0xc6ac('0x3')];module[_0xc6ac('0x4')]=function(_0x5328ce){return _0x5328ce[_0xc6ac('0x5')]('Interval',attributes,{'tableName':_0xc6ac('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x48323f){extensions[_0xc6ac('0x7')](_0x5328ce,_0x48323f);},'afterBulkCreate':function(_0x2b5cde,_0x23e315,_0x15e296){_0x15e296();extensions['rewrite'](_0x5328ce,_0x2b5cde[0x0]);},'afterUpdate':function(_0x1acca6){extensions[_0xc6ac('0x7')](_0x5328ce,_0x1acca6);},'afterDestroy':function(_0x157339){extensions[_0xc6ac('0x7')](_0x5328ce,_0x157339);}},'instanceMethods':{'ifTime':function(_0x46b622=undefined,_0xdc0c51=new Date()){if(typeof this[_0xc6ac('0x8')]===_0xc6ac('0x9')){return iftime(this['interval'],_0x46b622,_0xdc0c51);}else{return this['getIntervals']()[_0xc6ac('0xa')](function(_0x4d04e5){return Promise['all'](_0x4d04e5[_0xc6ac('0xb')](function(_0x54a472){return _0x54a472[_0xc6ac('0xc')](_0x46b622,_0xdc0c51);}));})[_0xc6ac('0xa')](function(_0x5b8e1f){return _0x5b8e1f[_0xc6ac('0xd')](function(_0x2908ec,_0x123545){return _0x2908ec||_0x123545;},![]);});}}}});};