cc8f9ca247e27993091ca8b09b59d2b88e6cc619
[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 _0x437d=['../../components/extensions/rewrite','../../utils/iftime','iftime','exports','Interval','tools_intervals','rewrite','string','interval','then','map','ifTime','reduce'];(function(_0x5ed848,_0x4656ce){var _0x3fc715=function(_0x103afb){while(--_0x103afb){_0x5ed848['push'](_0x5ed848['shift']());}};_0x3fc715(++_0x4656ce);}(_0x437d,0x16c));var _0xd437=function(_0x3220aa,_0x4e66d5){_0x3220aa=_0x3220aa-0x0;var _0x27eee9=_0x437d[_0x3220aa];return _0x27eee9;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xd437('0x0'));var iftime=require(_0xd437('0x1'))[_0xd437('0x2')];module[_0xd437('0x3')]=function(_0x49cf17){return _0x49cf17['define'](_0xd437('0x4'),attributes,{'tableName':_0xd437('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c566a){extensions[_0xd437('0x6')](_0x49cf17,_0x5c566a);},'afterBulkCreate':function(_0x25b165,_0x4f795c,_0x15eeaf){_0x15eeaf();extensions[_0xd437('0x6')](_0x49cf17,_0x25b165[0x0]);},'afterUpdate':function(_0x445aa5){extensions[_0xd437('0x6')](_0x49cf17,_0x445aa5);},'afterDestroy':function(_0x4d23ea){extensions['rewrite'](_0x49cf17,_0x4d23ea);}},'instanceMethods':{'ifTime':function(_0x15fab2=undefined,_0x1bd6e1=new Date()){if(typeof this['interval']===_0xd437('0x7')){return iftime(this[_0xd437('0x8')],_0x15fab2,_0x1bd6e1);}else{return this['getIntervals']()[_0xd437('0x9')](function(_0x1a6a73){return Promise['all'](_0x1a6a73[_0xd437('0xa')](function(_0x302fb3){return _0x302fb3[_0xd437('0xb')](_0x15fab2,_0x1bd6e1);}));})[_0xd437('0x9')](function(_0xc9ab5b){return _0xc9ab5b[_0xd437('0xc')](function(_0x138962,_0x46e4d4){return _0x138962||_0x46e4d4;},![]);});}}}});};