97c4d57d39aec932090e03340bffc1729825299c
[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 _0x2e3a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','FULLTEXT','models','get','toLowerCase','direction','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','utf8mb4','lodash','util','../../config/logger'];(function(_0x59ece4,_0xce6de0){var _0x56a0ba=function(_0x4df59c){while(--_0x4df59c){_0x59ece4['push'](_0x59ece4['shift']());}};_0x56a0ba(++_0xce6de0);}(_0x2e3a,0x1b0));var _0xa2e3=function(_0x1b0692,_0xcb7853){_0x1b0692=_0x1b0692-0x0;var _0x580b51=_0x2e3a[_0x1b0692];return _0x580b51;};'use strict';var _=require(_0xa2e3('0x0'));var util=require(_0xa2e3('0x1'));var logger=require(_0xa2e3('0x2'))(_0xa2e3('0x3'));var moment=require(_0xa2e3('0x4'));var BPromise=require(_0xa2e3('0x5'));var rp=require(_0xa2e3('0x6'));var fs=require('fs');var path=require(_0xa2e3('0x7'));var rimraf=require(_0xa2e3('0x8'));var config=require(_0xa2e3('0x9'));var attributes=require(_0xa2e3('0xa'));module[_0xa2e3('0xb')]=function(_0x42ec45,_0x2c8dcb){return _0x42ec45[_0xa2e3('0xc')](_0xa2e3('0xd'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xa2e3('0xe'),'fields':['body'],'type':_0xa2e3('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a0182,_0x3178ad,_0x43b23d){var _0xe2ba94=_0x42ec45[_0xa2e3('0x10')];var _0x415f3a=_0x4a0182[_0xa2e3('0x11')]({'plain':!![]});if(_0x415f3a['direction'][_0xa2e3('0x12')]()==='in'||_0x415f3a[_0xa2e3('0x13')]['toLowerCase']()==='out'&&!_0x415f3a[_0xa2e3('0x14')]&&!_['isNil'](_0x415f3a[_0xa2e3('0x15')])){_0xe2ba94[_0xa2e3('0x16')][_0xa2e3('0x17')]({'where':{'id':_0x415f3a[_0xa2e3('0x18')]}})[_0xa2e3('0x19')](function(_0x23ecca){if(_0x23ecca){_0x23ecca[_0xa2e3('0x1a')]({'lastMsgAt':_0x415f3a[_0xa2e3('0x1b')],'lastMsgDirection':_0x415f3a[_0xa2e3('0x13')][_0xa2e3('0x12')]()});}})['catch'](function(_0x3e3be9){console['error'](_0x3e3be9);});}_0x43b23d();}},'charset':_0xa2e3('0x1c'),'collate':'utf8mb4_unicode_ci'});};