26e7b842124f32509dfef3a221a7fafb440f06a1
[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 _0x968c=['FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body'];(function(_0x23c482,_0x395c9c){var _0x126d6a=function(_0x386aff){while(--_0x386aff){_0x23c482['push'](_0x23c482['shift']());}};_0x126d6a(++_0x395c9c);}(_0x968c,0xa5));var _0xc968=function(_0x5a3bf9,_0x1e7d51){_0x5a3bf9=_0x5a3bf9-0x0;var _0x4f3a1e=_0x968c[_0x5a3bf9];return _0x4f3a1e;};'use strict';var _=require(_0xc968('0x0'));var util=require(_0xc968('0x1'));var logger=require('../../config/logger')(_0xc968('0x2'));var moment=require(_0xc968('0x3'));var BPromise=require(_0xc968('0x4'));var rp=require(_0xc968('0x5'));var fs=require('fs');var path=require(_0xc968('0x6'));var rimraf=require('rimraf');var config=require(_0xc968('0x7'));var attributes=require(_0xc968('0x8'));module[_0xc968('0x9')]=function(_0x3a2ae8,_0x2b863a){return _0x3a2ae8[_0xc968('0xa')](_0xc968('0xb'),attributes,{'tableName':_0xc968('0xc'),'paranoid':![],'indexes':[{'name':_0xc968('0xd'),'fields':[_0xc968('0xe')],'type':_0xc968('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x221362,_0x380b68,_0x163725){var _0x779e7d=_0x3a2ae8['models'];var _0x551105=_0x221362[_0xc968('0x10')]({'plain':!![]});if(_0x551105[_0xc968('0x11')][_0xc968('0x12')]()==='in'||_0x551105[_0xc968('0x11')]['toLowerCase']()===_0xc968('0x13')&&!_0x551105[_0xc968('0x14')]&&!_[_0xc968('0x15')](_0x551105[_0xc968('0x16')])){_0x779e7d[_0xc968('0x17')]['findOne']({'where':{'id':_0x551105['FaxInteractionId']}})[_0xc968('0x18')](function(_0x10d61e){if(_0x10d61e){_0x10d61e[_0xc968('0x19')]({'lastMsgAt':_0x551105[_0xc968('0x1a')],'lastMsgDirection':_0x551105[_0xc968('0x11')][_0xc968('0x12')]()});}})[_0xc968('0x1b')](function(_0x58a47e){console[_0xc968('0x1c')](_0x58a47e);});}_0x163725();}},'charset':'utf8mb4','collate':_0xc968('0x1d')});};