Built motion from commit 3c2ce842.|2.6.31
[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 _0x9db1=['FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','then','update','createdAt','error','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body'];(function(_0x2dbdf6,_0x40f023){var _0x596b65=function(_0x949d14){while(--_0x949d14){_0x2dbdf6['push'](_0x2dbdf6['shift']());}};_0x596b65(++_0x40f023);}(_0x9db1,0x1d9));var _0x19db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9db1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x19db('0x0'));var util=require('util');var logger=require(_0x19db('0x1'))(_0x19db('0x2'));var moment=require('moment');var BPromise=require(_0x19db('0x3'));var rp=require(_0x19db('0x4'));var fs=require('fs');var path=require(_0x19db('0x5'));var rimraf=require('rimraf');var config=require(_0x19db('0x6'));var attributes=require(_0x19db('0x7'));module['exports']=function(_0x4947a0,_0x3b68c0){return _0x4947a0[_0x19db('0x8')](_0x19db('0x9'),attributes,{'tableName':_0x19db('0xa'),'paranoid':![],'indexes':[{'name':_0x19db('0xb'),'fields':[_0x19db('0xc')],'type':_0x19db('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x60b174,_0x4a7090,_0x1cbc89){var _0x1920f3=_0x4947a0[_0x19db('0xe')];var _0x136841=_0x60b174['get']({'plain':!![]});if(_0x136841[_0x19db('0xf')][_0x19db('0x10')]()==='in'||_0x136841[_0x19db('0xf')][_0x19db('0x10')]()===_0x19db('0x11')&&!_0x136841[_0x19db('0x12')]&&!_[_0x19db('0x13')](_0x136841[_0x19db('0x14')])){_0x1920f3[_0x19db('0x15')]['findOne']({'where':{'id':_0x136841['FaxInteractionId']}})[_0x19db('0x16')](function(_0x3bca7d){if(_0x3bca7d){_0x3bca7d[_0x19db('0x17')]({'lastMsgAt':_0x136841[_0x19db('0x18')],'lastMsgDirection':_0x136841[_0x19db('0xf')][_0x19db('0x10')]()});}})['catch'](function(_0xda09d9){console[_0x19db('0x19')](_0xda09d9);});}_0x1cbc89();}},'charset':_0x19db('0x1a'),'collate':'utf8mb4_unicode_ci'});};