f799e220d7eb58c2fd1f7a2a1108fa3b4bbe42e9
[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 _0xf46a=['string','getIntervals','all','map','ifTime','then','reduce','./interval.attributes','../../utils/iftime','exports','define','rewrite','interval'];(function(_0xa1e9a4,_0x30d157){var _0x3a7070=function(_0x52156f){while(--_0x52156f){_0xa1e9a4['push'](_0xa1e9a4['shift']());}};_0x3a7070(++_0x30d157);}(_0xf46a,0xfe));var _0xaf46=function(_0x1c086a,_0x454ce9){_0x1c086a=_0x1c086a-0x0;var _0x82a639=_0xf46a[_0x1c086a];return _0x82a639;};'use strict';var attributes=require(_0xaf46('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0xaf46('0x1'))['iftime'];module[_0xaf46('0x2')]=function(_0x5778a7){return _0x5778a7[_0xaf46('0x3')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f3277){extensions[_0xaf46('0x4')](_0x5778a7,_0x4f3277);},'afterBulkCreate':function(_0x591535,_0x48d885,_0x3dda84){_0x3dda84();extensions[_0xaf46('0x4')](_0x5778a7,_0x591535[0x0]);},'afterUpdate':function(_0x34b567){extensions['rewrite'](_0x5778a7,_0x34b567);},'afterDestroy':function(_0xce334e){extensions['rewrite'](_0x5778a7,_0xce334e);}},'instanceMethods':{'ifTime':function(_0x20251b=undefined,_0x5bff78=new Date()){if(typeof this[_0xaf46('0x5')]===_0xaf46('0x6')){return iftime(this[_0xaf46('0x5')],_0x20251b,_0x5bff78);}else{return this[_0xaf46('0x7')]()['then'](function(_0x44b5a3){return Promise[_0xaf46('0x8')](_0x44b5a3[_0xaf46('0x9')](function(_0x220b13){return _0x220b13[_0xaf46('0xa')](_0x20251b,_0x5bff78);}));})[_0xaf46('0xb')](function(_0x5ca538){return _0x5ca538[_0xaf46('0xc')](function(_0x395040,_0x46440e){return _0x395040||_0x46440e;},![]);});}}}});};