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 _0xdfe0=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','define','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','then','update'];(function(_0x392162,_0x2f2f33){var _0x3c2445=function(_0x589e9e){while(--_0x589e9e){_0x392162['push'](_0x392162['shift']());}};_0x3c2445(++_0x2f2f33);}(_0xdfe0,0x8b));var _0x0dfe=function(_0x28815c,_0x4dcb82){_0x28815c=_0x28815c-0x0;var _0x37580d=_0xdfe0[_0x28815c];return _0x37580d;};'use strict';var _=require(_0x0dfe('0x0'));var util=require(_0x0dfe('0x1'));var logger=require(_0x0dfe('0x2'))('api');var moment=require(_0x0dfe('0x3'));var BPromise=require(_0x0dfe('0x4'));var rp=require(_0x0dfe('0x5'));var fs=require('fs');var path=require(_0x0dfe('0x6'));var rimraf=require(_0x0dfe('0x7'));var config=require('../../config/environment');var attributes=require(_0x0dfe('0x8'));module['exports']=function(_0x4629be,_0x555468){return _0x4629be[_0x0dfe('0x9')]('FaxMessage',attributes,{'tableName':_0x0dfe('0xa'),'paranoid':![],'indexes':[{'name':_0x0dfe('0xb'),'fields':['body'],'type':_0x0dfe('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x267e66,_0x309b9c,_0xd4d5d2){var _0x5cbfe2=_0x4629be[_0x0dfe('0xd')];var _0x4c8829=_0x267e66[_0x0dfe('0xe')]({'plain':!![]});if(_0x4c8829[_0x0dfe('0xf')][_0x0dfe('0x10')]()==='in'||_0x4c8829[_0x0dfe('0xf')][_0x0dfe('0x10')]()==='out'&&!_0x4c8829[_0x0dfe('0x11')]&&!_[_0x0dfe('0x12')](_0x4c8829[_0x0dfe('0x13')])){_0x5cbfe2['FaxInteraction'][_0x0dfe('0x14')]({'where':{'id':_0x4c8829['FaxInteractionId']}})[_0x0dfe('0x15')](function(_0x30ced9){if(_0x30ced9){_0x30ced9[_0x0dfe('0x16')]({'lastMsgAt':_0x4c8829['createdAt'],'lastMsgDirection':_0x4c8829['direction'][_0x0dfe('0x10')]()});}})[_0x0dfe('0x17')](function(_0x1c5cdd){console[_0x0dfe('0x18')](_0x1c5cdd);});}_0xd4d5d2();}},'charset':_0x0dfe('0x19'),'collate':_0x0dfe('0x1a')});};