55e53d21e2f7772f4950c554ce3e143b2ba801f4
[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 _0x5aa6=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0x5aa6,0x18c));var _0x65aa=function(_0x588dac,_0x5136ef){_0x588dac=_0x588dac-0x0;var _0x11f74a=_0x5aa6[_0x588dac];return _0x11f74a;};'use strict';var _=require(_0x65aa('0x0'));var util=require(_0x65aa('0x1'));var logger=require(_0x65aa('0x2'))(_0x65aa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x65aa('0x4'));var rimraf=require('rimraf');var config=require(_0x65aa('0x5'));var attributes=require(_0x65aa('0x6'));module[_0x65aa('0x7')]=function(_0x535859,_0xffce66){return _0x535859[_0x65aa('0x8')]('FaxMessage',attributes,{'tableName':_0x65aa('0x9'),'paranoid':![],'indexes':[{'name':_0x65aa('0xa'),'fields':[_0x65aa('0xb')],'type':_0x65aa('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ed43e,_0x566df1,_0x5398b0){var _0x22ebf9=_0x535859[_0x65aa('0xd')];var _0x1204d7=_0x5ed43e['get']({'plain':!![]});if(_0x1204d7[_0x65aa('0xe')][_0x65aa('0xf')]()==='in'||_0x1204d7[_0x65aa('0xe')][_0x65aa('0xf')]()==='out'&&!_0x1204d7[_0x65aa('0x10')]&&!_[_0x65aa('0x11')](_0x1204d7[_0x65aa('0x12')])){_0x22ebf9[_0x65aa('0x13')][_0x65aa('0x14')]({'where':{'id':_0x1204d7[_0x65aa('0x15')]}})[_0x65aa('0x16')](function(_0x52ba1a){if(_0x52ba1a){_0x52ba1a[_0x65aa('0x17')]({'lastMsgAt':_0x1204d7['createdAt'],'lastMsgDirection':_0x1204d7['direction']['toLowerCase']()});}})[_0x65aa('0x18')](function(_0xa51ea5){console[_0x65aa('0x19')](_0xa51ea5);});}_0x5398b0();}},'charset':_0x65aa('0x1a'),'collate':_0x65aa('0x1b')});};