Built motion from commit c116dc8b.|2.6.30
[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 _0x62c5=['then','all','map','ifTime','./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','interval','string'];(function(_0x2dba5b,_0x23249b){var _0x1cbdbe=function(_0x53a50a){while(--_0x53a50a){_0x2dba5b['push'](_0x2dba5b['shift']());}};_0x1cbdbe(++_0x23249b);}(_0x62c5,0xb8));var _0x562c=function(_0x163f94,_0x1d0c28){_0x163f94=_0x163f94-0x0;var _0x3a7506=_0x62c5[_0x163f94];return _0x3a7506;};'use strict';var attributes=require(_0x562c('0x0'));var extensions=require(_0x562c('0x1'));var iftime=require('../../utils/iftime')['iftime'];module['exports']=function(_0x5d97c0){return _0x5d97c0[_0x562c('0x2')](_0x562c('0x3'),attributes,{'tableName':_0x562c('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x47cfb5){extensions[_0x562c('0x5')](_0x5d97c0,_0x47cfb5);},'afterBulkCreate':function(_0x48f2c0,_0x53b218,_0x111fba){_0x111fba();extensions[_0x562c('0x5')](_0x5d97c0,_0x48f2c0[0x0]);},'afterUpdate':function(_0x57836c){extensions[_0x562c('0x5')](_0x5d97c0,_0x57836c);},'afterDestroy':function(_0x185524){extensions['rewrite'](_0x5d97c0,_0x185524);}},'instanceMethods':{'ifTime':function(_0x3aca7f=undefined,_0x5aed26=new Date()){if(typeof this[_0x562c('0x6')]===_0x562c('0x7')){return iftime(this[_0x562c('0x6')],_0x3aca7f,_0x5aed26);}else{return this['getIntervals']()[_0x562c('0x8')](function(_0x254fbe){return Promise[_0x562c('0x9')](_0x254fbe[_0x562c('0xa')](function(_0x24c74a){return _0x24c74a[_0x562c('0xb')](_0x3aca7f,_0x5aed26);}));})['then'](function(_0x460fa8){return _0x460fa8['reduce'](function(_0x108190,_0x4fc2e1){return _0x108190||_0x4fc2e1;},![]);});}}}});};