Built motion from commit 5293bb2a.|2.6.30
[motion2.git] / server / api / faxMessage / faxMessage.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 _0xd549=['then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','fax_messages','fti_fax_messages','FULLTEXT','direction','toLowerCase','secret','isNil','UserId','FaxInteraction'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0xd549,0xce));var _0x9d54=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd549[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x9d54('0x0'));var util=require('util');var logger=require(_0x9d54('0x1'))(_0x9d54('0x2'));var moment=require(_0x9d54('0x3'));var BPromise=require(_0x9d54('0x4'));var rp=require(_0x9d54('0x5'));var fs=require('fs');var path=require(_0x9d54('0x6'));var rimraf=require(_0x9d54('0x7'));var config=require('../../config/environment');var attributes=require(_0x9d54('0x8'));module[_0x9d54('0x9')]=function(_0x302046,_0x34696c){return _0x302046['define']('FaxMessage',attributes,{'tableName':_0x9d54('0xa'),'paranoid':![],'indexes':[{'name':_0x9d54('0xb'),'fields':['body'],'type':_0x9d54('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x33b213,_0x591e04,_0x5b418d){var _0x2e600b=_0x302046['models'];var _0x2eaf59=_0x33b213['get']({'plain':!![]});if(_0x2eaf59[_0x9d54('0xd')][_0x9d54('0xe')]()==='in'||_0x2eaf59[_0x9d54('0xd')]['toLowerCase']()==='out'&&!_0x2eaf59[_0x9d54('0xf')]&&!_[_0x9d54('0x10')](_0x2eaf59[_0x9d54('0x11')])){_0x2e600b[_0x9d54('0x12')]['findOne']({'where':{'id':_0x2eaf59['FaxInteractionId']}})[_0x9d54('0x13')](function(_0x14defc){if(_0x14defc){_0x14defc['update']({'lastMsgAt':_0x2eaf59[_0x9d54('0x14')],'lastMsgDirection':_0x2eaf59['direction'][_0x9d54('0xe')]()});}})[_0x9d54('0x15')](function(_0x5d00e3){console[_0x9d54('0x16')](_0x5d00e3);});}_0x5b418d();}},'charset':_0x9d54('0x17'),'collate':_0x9d54('0x18')});};