Built motion from commit 3c2ce842.|2.6.31
[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 _0x5ff6=['getIntervals','all','map','ifTime','then','reduce','../../components/extensions/rewrite','iftime','define','Interval','rewrite','string','interval'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x5ff6,0x1cd));var _0x65ff=function(_0x4ec4f5,_0x4c1bcb){_0x4ec4f5=_0x4ec4f5-0x0;var _0x1603f0=_0x5ff6[_0x4ec4f5];return _0x1603f0;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x65ff('0x0'));var iftime=require('../../utils/iftime')[_0x65ff('0x1')];module['exports']=function(_0x39040c){return _0x39040c[_0x65ff('0x2')](_0x65ff('0x3'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d62e7){extensions[_0x65ff('0x4')](_0x39040c,_0x5d62e7);},'afterBulkCreate':function(_0x4b29a1,_0x373e08,_0x1b8cc6){_0x1b8cc6();extensions[_0x65ff('0x4')](_0x39040c,_0x4b29a1[0x0]);},'afterUpdate':function(_0x10dd4d){extensions['rewrite'](_0x39040c,_0x10dd4d);},'afterDestroy':function(_0x62dd7f){extensions[_0x65ff('0x4')](_0x39040c,_0x62dd7f);}},'instanceMethods':{'ifTime':function(_0x337567=undefined,_0x20eafd=new Date()){if(typeof this['interval']===_0x65ff('0x5')){return iftime(this[_0x65ff('0x6')],_0x337567,_0x20eafd);}else{return this[_0x65ff('0x7')]()['then'](function(_0x468db9){return Promise[_0x65ff('0x8')](_0x468db9[_0x65ff('0x9')](function(_0x3dd0dc){return _0x3dd0dc[_0x65ff('0xa')](_0x337567,_0x20eafd);}));})[_0x65ff('0xb')](function(_0x1b7e60){return _0x1b7e60[_0x65ff('0xc')](function(_0x1d1925,_0x4b4185){return _0x1d1925||_0x4b4185;},![]);});}}}});};