e8459451e0af8aa3796c5aede796a3e230eb8ace
[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 _0xc358=['getIntervals','then','map','ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','Interval','tools_intervals','rewrite','interval','string'];(function(_0x366255,_0x3edffb){var _0x2604b2=function(_0x512223){while(--_0x512223){_0x366255['push'](_0x366255['shift']());}};_0x2604b2(++_0x3edffb);}(_0xc358,0x131));var _0x8c35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc358[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x8c35('0x0'));var iftime=require(_0x8c35('0x1'))['iftime'];module['exports']=function(_0x51fa9a){return _0x51fa9a['define'](_0x8c35('0x2'),attributes,{'tableName':_0x8c35('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c3221){extensions[_0x8c35('0x4')](_0x51fa9a,_0x2c3221);},'afterBulkCreate':function(_0x448685,_0x14bbaf,_0x3b2641){_0x3b2641();extensions[_0x8c35('0x4')](_0x51fa9a,_0x448685[0x0]);},'afterUpdate':function(_0x292b3b){extensions[_0x8c35('0x4')](_0x51fa9a,_0x292b3b);},'afterDestroy':function(_0x268c6f){extensions[_0x8c35('0x4')](_0x51fa9a,_0x268c6f);}},'instanceMethods':{'ifTime':function(_0x42dc32=undefined,_0x92bf04=new Date()){if(typeof this[_0x8c35('0x5')]===_0x8c35('0x6')){return iftime(this[_0x8c35('0x5')],_0x42dc32,_0x92bf04);}else{return this[_0x8c35('0x7')]()[_0x8c35('0x8')](function(_0x402cd3){return Promise['all'](_0x402cd3[_0x8c35('0x9')](function(_0x2f284a){return _0x2f284a[_0x8c35('0xa')](_0x42dc32,_0x92bf04);}));})[_0x8c35('0x8')](function(_0x269c5f){return _0x269c5f[_0x8c35('0xb')](function(_0x1a899e,_0x126394){return _0x1a899e||_0x126394;},![]);});}}}});};