Built motion from commit 20b39a97.|2.6.29
[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 _0xb3c1=['FaxInteractionId','then','update','createdAt','catch','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x2c6a71,_0x245a2b){var _0x2d8e58=function(_0x3a811a){while(--_0x3a811a){_0x2c6a71['push'](_0x2c6a71['shift']());}};_0x2d8e58(++_0x245a2b);}(_0xb3c1,0xa7));var _0x1b3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3c1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1b3c('0x0'));var util=require(_0x1b3c('0x1'));var logger=require(_0x1b3c('0x2'))(_0x1b3c('0x3'));var moment=require('moment');var BPromise=require(_0x1b3c('0x4'));var rp=require(_0x1b3c('0x5'));var fs=require('fs');var path=require(_0x1b3c('0x6'));var rimraf=require(_0x1b3c('0x7'));var config=require('../../config/environment');var attributes=require(_0x1b3c('0x8'));module[_0x1b3c('0x9')]=function(_0x52c83d,_0x24859c){return _0x52c83d[_0x1b3c('0xa')](_0x1b3c('0xb'),attributes,{'tableName':_0x1b3c('0xc'),'paranoid':![],'indexes':[{'name':_0x1b3c('0xd'),'fields':['body'],'type':_0x1b3c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ba39b,_0x5bf1c8,_0x48fc89){var _0x596547=_0x52c83d[_0x1b3c('0xf')];var _0x2f557a=_0x2ba39b[_0x1b3c('0x10')]({'plain':!![]});if(_0x2f557a[_0x1b3c('0x11')][_0x1b3c('0x12')]()==='in'||_0x2f557a[_0x1b3c('0x11')][_0x1b3c('0x12')]()===_0x1b3c('0x13')&&!_0x2f557a[_0x1b3c('0x14')]&&!_[_0x1b3c('0x15')](_0x2f557a['UserId'])){_0x596547['FaxInteraction']['findOne']({'where':{'id':_0x2f557a[_0x1b3c('0x16')]}})[_0x1b3c('0x17')](function(_0x4dc0ab){if(_0x4dc0ab){_0x4dc0ab[_0x1b3c('0x18')]({'lastMsgAt':_0x2f557a[_0x1b3c('0x19')],'lastMsgDirection':_0x2f557a[_0x1b3c('0x11')]['toLowerCase']()});}})[_0x1b3c('0x1a')](function(_0x4a5ae0){console['error'](_0x4a5ae0);});}_0x48fc89();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};