Built motion from commit e1760111.|2.6.18
[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 _0xecd9=['./faxMessage.attributes','exports','FaxMessage','fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x350f77,_0x12a9b8){var _0x1305b6=function(_0x1477a9){while(--_0x1477a9){_0x350f77['push'](_0x350f77['shift']());}};_0x1305b6(++_0x12a9b8);}(_0xecd9,0x14c));var _0x9ecd=function(_0x2d495a,_0x400c00){_0x2d495a=_0x2d495a-0x0;var _0x2c5877=_0xecd9[_0x2d495a];return _0x2c5877;};'use strict';var _=require(_0x9ecd('0x0'));var util=require(_0x9ecd('0x1'));var logger=require('../../config/logger')(_0x9ecd('0x2'));var moment=require(_0x9ecd('0x3'));var BPromise=require(_0x9ecd('0x4'));var rp=require(_0x9ecd('0x5'));var fs=require('fs');var path=require(_0x9ecd('0x6'));var rimraf=require(_0x9ecd('0x7'));var config=require(_0x9ecd('0x8'));var attributes=require(_0x9ecd('0x9'));module[_0x9ecd('0xa')]=function(_0x2bd97b,_0x23bf4a){return _0x2bd97b['define'](_0x9ecd('0xb'),attributes,{'tableName':_0x9ecd('0xc'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x9ecd('0xd')],'type':_0x9ecd('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x552fae,_0x1a441e,_0x744469){var _0xa49bbf=_0x2bd97b[_0x9ecd('0xf')];var _0x31d871=_0x552fae['get']({'plain':!![]});if(_0x31d871[_0x9ecd('0x10')][_0x9ecd('0x11')]()==='in'||_0x31d871['direction'][_0x9ecd('0x11')]()===_0x9ecd('0x12')&&!_0x31d871[_0x9ecd('0x13')]&&!_[_0x9ecd('0x14')](_0x31d871[_0x9ecd('0x15')])){_0xa49bbf[_0x9ecd('0x16')][_0x9ecd('0x17')]({'where':{'id':_0x31d871[_0x9ecd('0x18')]}})[_0x9ecd('0x19')](function(_0x7537b9){if(_0x7537b9){_0x7537b9[_0x9ecd('0x1a')]({'lastMsgAt':_0x31d871[_0x9ecd('0x1b')],'lastMsgDirection':_0x31d871[_0x9ecd('0x10')]['toLowerCase']()});}})[_0x9ecd('0x1c')](function(_0x3f9dae){console['error'](_0x3f9dae);});}_0x744469();}},'charset':_0x9ecd('0x1d'),'collate':_0x9ecd('0x1e')});};