df31c24fe8a099c12b691da6f7cc00161a3aff73
[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 _0xd449=['get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','then','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models'];(function(_0x191f56,_0x5678e0){var _0x49010c=function(_0x17ed88){while(--_0x17ed88){_0x191f56['push'](_0x191f56['shift']());}};_0x49010c(++_0x5678e0);}(_0xd449,0x82));var _0x9d44=function(_0x5de818,_0x7c4485){_0x5de818=_0x5de818-0x0;var _0x345670=_0xd449[_0x5de818];return _0x345670;};'use strict';var _=require('lodash');var util=require(_0x9d44('0x0'));var logger=require(_0x9d44('0x1'))(_0x9d44('0x2'));var moment=require('moment');var BPromise=require(_0x9d44('0x3'));var rp=require(_0x9d44('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d44('0x5'));var config=require(_0x9d44('0x6'));var attributes=require(_0x9d44('0x7'));module[_0x9d44('0x8')]=function(_0x1c3697,_0x5d247b){return _0x1c3697['define'](_0x9d44('0x9'),attributes,{'tableName':_0x9d44('0xa'),'paranoid':![],'indexes':[{'name':_0x9d44('0xb'),'fields':[_0x9d44('0xc')],'type':_0x9d44('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xebb20b,_0x10ec5a,_0x55acfb){var _0x194fe8=_0x1c3697[_0x9d44('0xe')];var _0x5b060e=_0xebb20b[_0x9d44('0xf')]({'plain':!![]});if(_0x5b060e[_0x9d44('0x10')][_0x9d44('0x11')]()==='in'||_0x5b060e[_0x9d44('0x10')][_0x9d44('0x11')]()===_0x9d44('0x12')&&!_0x5b060e[_0x9d44('0x13')]&&!_[_0x9d44('0x14')](_0x5b060e[_0x9d44('0x15')])){_0x194fe8['FaxInteraction'][_0x9d44('0x16')]({'where':{'id':_0x5b060e[_0x9d44('0x17')]}})[_0x9d44('0x18')](function(_0x40f9c2){if(_0x40f9c2){_0x40f9c2['update']({'lastMsgAt':_0x5b060e['createdAt'],'lastMsgDirection':_0x5b060e['direction'][_0x9d44('0x11')]()});}})[_0x9d44('0x19')](function(_0x426b03){console[_0x9d44('0x1a')](_0x426b03);});}_0x55acfb();}},'charset':_0x9d44('0x1b'),'collate':_0x9d44('0x1c')});};