Built motion from commit ffdca78c.|2.6.24
[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 _0x8596=['tools_intervals','rewrite','string','interval','then','all','map','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval'];(function(_0x2fbcf6,_0x2e7155){var _0x3e7265=function(_0x15a3c3){while(--_0x15a3c3){_0x2fbcf6['push'](_0x2fbcf6['shift']());}};_0x3e7265(++_0x2e7155);}(_0x8596,0x14a));var _0x6859=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8596[_0x21a9d9];return _0x46adce;};'use strict';var attributes=require(_0x6859('0x0'));var extensions=require(_0x6859('0x1'));var iftime=require(_0x6859('0x2'))['iftime'];module[_0x6859('0x3')]=function(_0x5a9461){return _0x5a9461[_0x6859('0x4')](_0x6859('0x5'),attributes,{'tableName':_0x6859('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2375f9){extensions[_0x6859('0x7')](_0x5a9461,_0x2375f9);},'afterBulkCreate':function(_0x5e247a,_0x252f68,_0x1985a2){_0x1985a2();extensions[_0x6859('0x7')](_0x5a9461,_0x5e247a[0x0]);},'afterUpdate':function(_0x324b4d){extensions['rewrite'](_0x5a9461,_0x324b4d);},'afterDestroy':function(_0x1ef9d2){extensions[_0x6859('0x7')](_0x5a9461,_0x1ef9d2);}},'instanceMethods':{'ifTime':function(_0x4c975f=undefined,_0x2bf1a3=new Date()){if(typeof this['interval']===_0x6859('0x8')){return iftime(this[_0x6859('0x9')],_0x4c975f,_0x2bf1a3);}else{return this['getIntervals']()[_0x6859('0xa')](function(_0x1a757c){return Promise[_0x6859('0xb')](_0x1a757c[_0x6859('0xc')](function(_0x3e7f13){return _0x3e7f13['ifTime'](_0x4c975f,_0x2bf1a3);}));})['then'](function(_0x260b09){return _0x260b09[_0x6859('0xd')](function(_0x3a296f,_0x5eab42){return _0x3a296f||_0x5eab42;},![]);});}}}});};