51a118d64d58a195a19daba6017d203dc023eb66
[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 _0xe89a=['map','ifTime','reduce','./interval.attributes','../../utils/iftime','define','Interval','tools_intervals','rewrite','interval','string','then','all'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xe89a,0x1e4));var _0xae89=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xe89a[_0x255d5b];return _0x3e141a;};'use strict';var attributes=require(_0xae89('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0xae89('0x1'))['iftime'];module['exports']=function(_0x6bed7c){return _0x6bed7c[_0xae89('0x2')](_0xae89('0x3'),attributes,{'tableName':_0xae89('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x15c756){extensions[_0xae89('0x5')](_0x6bed7c,_0x15c756);},'afterBulkCreate':function(_0x5158cb,_0x164a1c,_0x11fcad){_0x11fcad();extensions[_0xae89('0x5')](_0x6bed7c,_0x5158cb[0x0]);},'afterUpdate':function(_0x25bcf4){extensions[_0xae89('0x5')](_0x6bed7c,_0x25bcf4);},'afterDestroy':function(_0x5c45a1){extensions[_0xae89('0x5')](_0x6bed7c,_0x5c45a1);}},'instanceMethods':{'ifTime':function(_0x3f7338=undefined,_0x3658f1=new Date()){if(typeof this[_0xae89('0x6')]===_0xae89('0x7')){return iftime(this[_0xae89('0x6')],_0x3f7338,_0x3658f1);}else{return this['getIntervals']()[_0xae89('0x8')](function(_0x197c35){return Promise[_0xae89('0x9')](_0x197c35[_0xae89('0xa')](function(_0x2ee879){return _0x2ee879[_0xae89('0xb')](_0x3f7338,_0x3658f1);}));})[_0xae89('0x8')](function(_0x4d3c18){return _0x4d3c18[_0xae89('0xc')](function(_0x20d7bc,_0x517601){return _0x20d7bc||_0x517601;},![]);});}}}});};