Built motion from commit (unavailable).|2.4.19
[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 _0x21ed=['exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','toLowerCase','direction','secret','isNil','UserId','findOne','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','request-promise','path','./faxMessage.attributes'];(function(_0x2afa1e,_0x5f37fa){var _0x4b3ab7=function(_0x953dba){while(--_0x953dba){_0x2afa1e['push'](_0x2afa1e['shift']());}};_0x4b3ab7(++_0x5f37fa);}(_0x21ed,0x17a));var _0xd21e=function(_0x361eec,_0x25d17d){_0x361eec=_0x361eec-0x0;var _0x135971=_0x21ed[_0x361eec];return _0x135971;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd21e('0x0'))(_0xd21e('0x1'));var moment=require('moment');var BPromise=require(_0xd21e('0x2'));var rp=require(_0xd21e('0x3'));var fs=require('fs');var path=require(_0xd21e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd21e('0x5'));module[_0xd21e('0x6')]=function(_0x2a4978,_0x2ad58f){return _0x2a4978[_0xd21e('0x7')](_0xd21e('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xd21e('0x9'),'fields':[_0xd21e('0xa')],'type':_0xd21e('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x418106,_0x35db82,_0x110afb){var _0xdff70a=_0x2a4978[_0xd21e('0xc')];var _0x5acaf8=_0x418106['get']({'plain':!![]});if(_0x5acaf8['direction'][_0xd21e('0xd')]()==='in'||_0x5acaf8[_0xd21e('0xe')][_0xd21e('0xd')]()==='out'&&!_0x5acaf8[_0xd21e('0xf')]&&!_[_0xd21e('0x10')](_0x5acaf8[_0xd21e('0x11')])){_0xdff70a['FaxInteraction'][_0xd21e('0x12')]({'where':{'id':_0x5acaf8['FaxInteractionId']}})[_0xd21e('0x13')](function(_0x3afb25){if(_0x3afb25){_0x3afb25['update']({'lastMsgAt':_0x5acaf8[_0xd21e('0x14')],'lastMsgDirection':_0x5acaf8[_0xd21e('0xe')]['toLowerCase']()});}})[_0xd21e('0x15')](function(_0x8b0ff5){console['error'](_0x8b0ff5);});}_0x110afb();}},'charset':_0xd21e('0x16'),'collate':_0xd21e('0x17')});};