Built motion from commit 00bf23f6.|2.6.16
[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 _0x745a=['iftime','exports','tools_intervals','rewrite','interval','string','getIntervals','all','ifTime','then','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime'];(function(_0x3ef668,_0x12bce9){var _0x6f96d2=function(_0x2f4939){while(--_0x2f4939){_0x3ef668['push'](_0x3ef668['shift']());}};_0x6f96d2(++_0x12bce9);}(_0x745a,0x1e7));var _0xa745=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x745a[_0x4fbfd9];return _0x31dc94;};'use strict';var attributes=require(_0xa745('0x0'));var extensions=require(_0xa745('0x1'));var iftime=require(_0xa745('0x2'))[_0xa745('0x3')];module[_0xa745('0x4')]=function(_0x74f7c9){return _0x74f7c9['define']('Interval',attributes,{'tableName':_0xa745('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x22d129){extensions['rewrite'](_0x74f7c9,_0x22d129);},'afterBulkCreate':function(_0x39a69b,_0xce37dd,_0x2a53dd){_0x2a53dd();extensions[_0xa745('0x6')](_0x74f7c9,_0x39a69b[0x0]);},'afterUpdate':function(_0x15fd0a){extensions[_0xa745('0x6')](_0x74f7c9,_0x15fd0a);},'afterDestroy':function(_0x29b010){extensions['rewrite'](_0x74f7c9,_0x29b010);}},'instanceMethods':{'ifTime':function(_0x5ef359=undefined,_0x39f736=new Date()){if(typeof this[_0xa745('0x7')]===_0xa745('0x8')){return iftime(this[_0xa745('0x7')],_0x5ef359,_0x39f736);}else{return this[_0xa745('0x9')]()['then'](function(_0x56af12){return Promise[_0xa745('0xa')](_0x56af12['map'](function(_0x18b1fd){return _0x18b1fd[_0xa745('0xb')](_0x5ef359,_0x39f736);}));})[_0xa745('0xc')](function(_0xd4832b){return _0xd4832b[_0xa745('0xd')](function(_0x1ced6c,_0x24f3a0){return _0x1ced6c||_0x24f3a0;},![]);});}}}});};