Built motion from commit (unavailable).|2.5.4
[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 _0xb50e=['FULLTEXT','models','toLowerCase','direction','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','define','body'];(function(_0x1a2a4c,_0x177909){var _0x4e0d5b=function(_0x132e1b){while(--_0x132e1b){_0x1a2a4c['push'](_0x1a2a4c['shift']());}};_0x4e0d5b(++_0x177909);}(_0xb50e,0xb5));var _0xeb50=function(_0x4ef8bc,_0x5eb00d){_0x4ef8bc=_0x4ef8bc-0x0;var _0x5d4d56=_0xb50e[_0x4ef8bc];return _0x5d4d56;};'use strict';var _=require('lodash');var util=require(_0xeb50('0x0'));var logger=require(_0xeb50('0x1'))(_0xeb50('0x2'));var moment=require(_0xeb50('0x3'));var BPromise=require(_0xeb50('0x4'));var rp=require(_0xeb50('0x5'));var fs=require('fs');var path=require(_0xeb50('0x6'));var rimraf=require(_0xeb50('0x7'));var config=require('../../config/environment');var attributes=require(_0xeb50('0x8'));module['exports']=function(_0x44ba26,_0x394077){return _0x44ba26[_0xeb50('0x9')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xeb50('0xa')],'type':_0xeb50('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f429c,_0x95b494,_0x2597f3){var _0x5b9965=_0x44ba26[_0xeb50('0xc')];var _0x50a1a9=_0x5f429c['get']({'plain':!![]});if(_0x50a1a9['direction'][_0xeb50('0xd')]()==='in'||_0x50a1a9[_0xeb50('0xe')][_0xeb50('0xd')]()===_0xeb50('0xf')&&!_0x50a1a9['secret']&&!_[_0xeb50('0x10')](_0x50a1a9[_0xeb50('0x11')])){_0x5b9965[_0xeb50('0x12')][_0xeb50('0x13')]({'where':{'id':_0x50a1a9[_0xeb50('0x14')]}})[_0xeb50('0x15')](function(_0x914922){if(_0x914922){_0x914922['update']({'lastMsgAt':_0x50a1a9[_0xeb50('0x16')],'lastMsgDirection':_0x50a1a9[_0xeb50('0xe')][_0xeb50('0xd')]()});}})[_0xeb50('0x17')](function(_0x5a33ed){console['error'](_0x5a33ed);});}_0x2597f3();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};