ccdea9221e12acd230a968746521c46439e9096c
[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 _0xc3f5=['string','getIntervals','then','all','map','ifTime','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','Interval','tools_intervals','rewrite','interval'];(function(_0x1fed80,_0x3e3e3a){var _0x3fc56a=function(_0x5a328a){while(--_0x5a328a){_0x1fed80['push'](_0x1fed80['shift']());}};_0x3fc56a(++_0x3e3e3a);}(_0xc3f5,0x1aa));var _0x5c3f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc3f5[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0x5c3f('0x0'));var extensions=require(_0x5c3f('0x1'));var iftime=require(_0x5c3f('0x2'))[_0x5c3f('0x3')];module[_0x5c3f('0x4')]=function(_0x16ccbf){return _0x16ccbf['define'](_0x5c3f('0x5'),attributes,{'tableName':_0x5c3f('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x522688){extensions['rewrite'](_0x16ccbf,_0x522688);},'afterBulkCreate':function(_0x5cbd0b,_0x561f59,_0x2bbd60){_0x2bbd60();extensions[_0x5c3f('0x7')](_0x16ccbf,_0x5cbd0b[0x0]);},'afterUpdate':function(_0x205017){extensions[_0x5c3f('0x7')](_0x16ccbf,_0x205017);},'afterDestroy':function(_0x53fa23){extensions[_0x5c3f('0x7')](_0x16ccbf,_0x53fa23);}},'instanceMethods':{'ifTime':function(_0x3ef51c=undefined,_0x14a247=new Date()){if(typeof this[_0x5c3f('0x8')]===_0x5c3f('0x9')){return iftime(this['interval'],_0x3ef51c,_0x14a247);}else{return this[_0x5c3f('0xa')]()[_0x5c3f('0xb')](function(_0x3724e2){return Promise[_0x5c3f('0xc')](_0x3724e2[_0x5c3f('0xd')](function(_0x26c5a4){return _0x26c5a4[_0x5c3f('0xe')](_0x3ef51c,_0x14a247);}));})[_0x5c3f('0xb')](function(_0x44e4f3){return _0x44e4f3['reduce'](function(_0x4338a3,_0x2825a1){return _0x4338a3||_0x2825a1;},![]);});}}}});};