Built motion from commit (unavailable).|2.5.28
[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 _0x50f4=['bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','FaxInteraction','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0xead5f0,_0x30581c){var _0x73c2a6=function(_0x27f32d){while(--_0x27f32d){_0xead5f0['push'](_0xead5f0['shift']());}};_0x73c2a6(++_0x30581c);}(_0x50f4,0x6c));var _0x450f=function(_0x1e8966,_0x4f4912){_0x1e8966=_0x1e8966-0x0;var _0x1aff9c=_0x50f4[_0x1e8966];return _0x1aff9c;};'use strict';var _=require('lodash');var util=require(_0x450f('0x0'));var logger=require(_0x450f('0x1'))(_0x450f('0x2'));var moment=require(_0x450f('0x3'));var BPromise=require(_0x450f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x450f('0x5'));var rimraf=require(_0x450f('0x6'));var config=require(_0x450f('0x7'));var attributes=require(_0x450f('0x8'));module[_0x450f('0x9')]=function(_0x271b70,_0x3e6c30){return _0x271b70[_0x450f('0xa')](_0x450f('0xb'),attributes,{'tableName':_0x450f('0xc'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0x450f('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x454b70,_0x3b93b1,_0x470dc8){var _0x1a5c7d=_0x271b70[_0x450f('0xe')];var _0x20881b=_0x454b70['get']({'plain':!![]});if(_0x20881b[_0x450f('0xf')][_0x450f('0x10')]()==='in'||_0x20881b[_0x450f('0xf')][_0x450f('0x10')]()===_0x450f('0x11')&&!_0x20881b[_0x450f('0x12')]&&!_['isNil'](_0x20881b[_0x450f('0x13')])){_0x1a5c7d[_0x450f('0x14')]['findOne']({'where':{'id':_0x20881b['FaxInteractionId']}})[_0x450f('0x15')](function(_0x1111d7){if(_0x1111d7){_0x1111d7[_0x450f('0x16')]({'lastMsgAt':_0x20881b[_0x450f('0x17')],'lastMsgDirection':_0x20881b[_0x450f('0xf')][_0x450f('0x10')]()});}})[_0x450f('0x18')](function(_0x16fa68){console[_0x450f('0x19')](_0x16fa68);});}_0x470dc8();}},'charset':_0x450f('0x1a'),'collate':_0x450f('0x1b')});};