Built motion from commit (unavailable).|2.4.6
[motion2.git] / server / api / screenRecording / screenRecording.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 _0x4727=['log','catch','resolve','util','api','bluebird','rimraf','../../config/environment','./screenRecording.attributes','define','screen_recordings','interactionid','isNil','value','join','server','files','existsSync'];(function(_0x31fc0d,_0x2dd37d){var _0x14153a=function(_0x345b6e){while(--_0x345b6e){_0x31fc0d['push'](_0x31fc0d['shift']());}};_0x14153a(++_0x2dd37d);}(_0x4727,0x111));var _0x7472=function(_0x3b2a7f,_0xb24aa5){_0x3b2a7f=_0x3b2a7f-0x0;var _0x47ccb9=_0x4727[_0x3b2a7f];return _0x47ccb9;};'use strict';var _=require('lodash');var util=require(_0x7472('0x0'));var logger=require('../../config/logger')(_0x7472('0x1'));var moment=require('moment');var BPromise=require(_0x7472('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7472('0x3'));var config=require(_0x7472('0x4'));var attributes=require(_0x7472('0x5'));module['exports']=function(_0x4c6b79,_0x29f268){return _0x4c6b79[_0x7472('0x6')]('ScreenRecording',attributes,{'tableName':_0x7472('0x7'),'paranoid':![],'indexes':[{'name':_0x7472('0x8'),'fields':[_0x7472('0x8')]}],'timestamps':!![],'hooks':{'afterDestroy':function(_0x463ff6,_0x31b156,_0x45fc10){return new BPromise(function(_0x266862,_0xcee189){if(!_[_0x7472('0x9')](_0x463ff6[_0x7472('0xa')])){var _0x1a48c6=path[_0x7472('0xb')](config['root'],_0x7472('0xc'),_0x7472('0xd'),_0x7472('0x7'),_0x463ff6[_0x7472('0xa')]);if(fs[_0x7472('0xe')](_0x1a48c6)){rimraf(_0x1a48c6,function(_0x24d297){if(_0x24d297){console[_0x7472('0xf')](_0x24d297);}});}}_0x266862();})[_0x7472('0x10')](function(_0x2ceb42){BPromise[_0x7472('0x11')]();})['finally'](function(){_0x45fc10();});}}});};