030dab657653b5006fb6cbfd6dbb3e4890cc15b3
[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 _0xc588=['interval','getIntervals','then','all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0xc588,0x19a));var _0x8c58=function(_0x4d189e,_0x2c0a04){_0x4d189e=_0x4d189e-0x0;var _0x1b36df=_0xc588[_0x4d189e];return _0x1b36df;};'use strict';var attributes=require(_0x8c58('0x0'));var extensions=require(_0x8c58('0x1'));var iftime=require('../../utils/iftime')['iftime'];module[_0x8c58('0x2')]=function(_0x79b1bc){return _0x79b1bc[_0x8c58('0x3')]('Interval',attributes,{'tableName':_0x8c58('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1685ff){extensions[_0x8c58('0x5')](_0x79b1bc,_0x1685ff);},'afterBulkCreate':function(_0x42fe2d,_0x5d1e87,_0x509749){_0x509749();extensions[_0x8c58('0x5')](_0x79b1bc,_0x42fe2d[0x0]);},'afterUpdate':function(_0x32a51e){extensions['rewrite'](_0x79b1bc,_0x32a51e);},'afterDestroy':function(_0xa1eb3){extensions[_0x8c58('0x5')](_0x79b1bc,_0xa1eb3);}},'instanceMethods':{'ifTime':function(_0x5a58bf=undefined,_0x9288cd=new Date()){if(typeof this[_0x8c58('0x6')]==='string'){return iftime(this[_0x8c58('0x6')],_0x5a58bf,_0x9288cd);}else{return this[_0x8c58('0x7')]()[_0x8c58('0x8')](function(_0x3d0f26){return Promise[_0x8c58('0x9')](_0x3d0f26[_0x8c58('0xa')](function(_0x151ba9){return _0x151ba9[_0x8c58('0xb')](_0x5a58bf,_0x9288cd);}));})[_0x8c58('0x8')](function(_0x5d6e38){return _0x5d6e38[_0x8c58('0xc')](function(_0x24d030,_0x286d38){return _0x24d030||_0x286d38;},![]);});}}}});};