Built motion from commit (unavailable).|2.0.83
[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 _0x570f=['update','createdAt','body','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','exports','define','fax_messages','models','get','direction','toLowerCase','out','UserId','FaxInteraction','findOne','then'];(function(_0xb68695,_0x1881a4){var _0x15a817=function(_0x4d04d6){while(--_0x4d04d6){_0xb68695['push'](_0xb68695['shift']());}};_0x15a817(++_0x1881a4);}(_0x570f,0x1a5));var _0xf570=function(_0x216327,_0x5482e3){_0x216327=_0x216327-0x0;var _0x4f152b=_0x570f[_0x216327];return _0x4f152b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf570('0x0'))('api');var moment=require(_0xf570('0x1'));var BPromise=require(_0xf570('0x2'));var rp=require(_0xf570('0x3'));var attributes=require('./faxMessage.attributes');module[_0xf570('0x4')]=function(_0x42fa40,_0x2b3cef){return _0x42fa40[_0xf570('0x5')]('FaxMessage',attributes,{'tableName':_0xf570('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x53c6f0,_0x1f06f7,_0x1e727){var _0x236fdc=_0x42fa40[_0xf570('0x7')];var _0xca61fc=_0x53c6f0[_0xf570('0x8')]({'plain':!![]});if(_0xca61fc[_0xf570('0x9')][_0xf570('0xa')]()==='in'||_0xca61fc[_0xf570('0x9')][_0xf570('0xa')]()===_0xf570('0xb')&&!_0xca61fc['secret']&&!_['isNil'](_0xca61fc[_0xf570('0xc')])){_0x236fdc[_0xf570('0xd')][_0xf570('0xe')]({'where':{'id':_0xca61fc['FaxInteractionId']}})[_0xf570('0xf')](function(_0x401366){if(_0x401366){_0x401366[_0xf570('0x10')]({'lastMsgAt':_0xca61fc[_0xf570('0x11')],'lastMsgDirection':_0xca61fc[_0xf570('0x9')][_0xf570('0xa')](),'lastMsgBody':_0xca61fc[_0xf570('0x12')]});}})[_0xf570('0x13')](function(_0x1a92c8){console[_0xf570('0x14')](_0x1a92c8);});}_0x1e727();}},'charset':_0xf570('0x15'),'collate':_0xf570('0x16')});};