69e99d7322859545d6c4a4361d0e7ae479fccc1a
[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 _0x1071=['rewrite','interval','string','getIntervals','then','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval'];(function(_0x5012b6,_0x510fe6){var _0x3514d2=function(_0x5ef76c){while(--_0x5ef76c){_0x5012b6['push'](_0x5012b6['shift']());}};_0x3514d2(++_0x510fe6);}(_0x1071,0x180));var _0x1107=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1071[_0x432682];return _0x463d05;};'use strict';var attributes=require(_0x1107('0x0'));var extensions=require(_0x1107('0x1'));var iftime=require(_0x1107('0x2'))['iftime'];module[_0x1107('0x3')]=function(_0x175918){return _0x175918[_0x1107('0x4')](_0x1107('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c41cb){extensions[_0x1107('0x6')](_0x175918,_0x4c41cb);},'afterBulkCreate':function(_0x12c785,_0x50710d,_0x3900d8){_0x3900d8();extensions[_0x1107('0x6')](_0x175918,_0x12c785[0x0]);},'afterUpdate':function(_0x9c29be){extensions[_0x1107('0x6')](_0x175918,_0x9c29be);},'afterDestroy':function(_0x1b5e2f){extensions[_0x1107('0x6')](_0x175918,_0x1b5e2f);}},'instanceMethods':{'ifTime':function(_0xaee01d=undefined,_0x5898b8=new Date()){if(typeof this[_0x1107('0x7')]===_0x1107('0x8')){return iftime(this['interval'],_0xaee01d,_0x5898b8);}else{return this[_0x1107('0x9')]()[_0x1107('0xa')](function(_0x52063c){return Promise['all'](_0x52063c['map'](function(_0x10d24d){return _0x10d24d[_0x1107('0xb')](_0xaee01d,_0x5898b8);}));})[_0x1107('0xa')](function(_0x5033b6){return _0x5033b6[_0x1107('0xc')](function(_0xe47ffc,_0x31bbe){return _0xe47ffc||_0x31bbe;},![]);});}}}});};