3b53fe041e2e4a12394694a4d7c1ae0ed40476a1
[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 _0x0f5b=['iftime','exports','define','Interval','rewrite','string','interval','getIntervals','all','map','ifTime','then','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime'];(function(_0x33ba56,_0x58a5ec){var _0x17371f=function(_0x54ac9b){while(--_0x54ac9b){_0x33ba56['push'](_0x33ba56['shift']());}};_0x17371f(++_0x58a5ec);}(_0x0f5b,0x1ec));var _0xb0f5=function(_0xfe4370,_0x4032c3){_0xfe4370=_0xfe4370-0x0;var _0x2e9a4c=_0x0f5b[_0xfe4370];return _0x2e9a4c;};'use strict';var attributes=require(_0xb0f5('0x0'));var extensions=require(_0xb0f5('0x1'));var iftime=require(_0xb0f5('0x2'))[_0xb0f5('0x3')];module[_0xb0f5('0x4')]=function(_0x2ba06e){return _0x2ba06e[_0xb0f5('0x5')](_0xb0f5('0x6'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x15ea96){extensions[_0xb0f5('0x7')](_0x2ba06e,_0x15ea96);},'afterBulkCreate':function(_0x19792d,_0x306ed9,_0x3269c5){_0x3269c5();extensions[_0xb0f5('0x7')](_0x2ba06e,_0x19792d[0x0]);},'afterUpdate':function(_0xfb1fa8){extensions[_0xb0f5('0x7')](_0x2ba06e,_0xfb1fa8);},'afterDestroy':function(_0x12e0a7){extensions['rewrite'](_0x2ba06e,_0x12e0a7);}},'instanceMethods':{'ifTime':function(_0x97b9b=undefined,_0xc13614=new Date()){if(typeof this['interval']===_0xb0f5('0x8')){return iftime(this[_0xb0f5('0x9')],_0x97b9b,_0xc13614);}else{return this[_0xb0f5('0xa')]()['then'](function(_0x419319){return Promise[_0xb0f5('0xb')](_0x419319[_0xb0f5('0xc')](function(_0x4fcd66){return _0x4fcd66[_0xb0f5('0xd')](_0x97b9b,_0xc13614);}));})[_0xb0f5('0xe')](function(_0x475bc1){return _0x475bc1['reduce'](function(_0x4f7fa8,_0x422490){return _0x4f7fa8||_0x422490;},![]);});}}}});};