Built motion from commit (unavailable).|2.0.70
[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 _0x43cb=['toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','then','update','direction','body','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','./faxMessage.attributes','fax_messages','models'];(function(_0x544f7c,_0x2adb42){var _0x563276=function(_0x3a90dc){while(--_0x3a90dc){_0x544f7c['push'](_0x544f7c['shift']());}};_0x563276(++_0x2adb42);}(_0x43cb,0x17e));var _0xb43c=function(_0x5db18c,_0x43424e){_0x5db18c=_0x5db18c-0x0;var _0x261b2a=_0x43cb[_0x5db18c];return _0x261b2a;};'use strict';var _=require(_0xb43c('0x0'));var util=require(_0xb43c('0x1'));var logger=require(_0xb43c('0x2'))('api');var moment=require(_0xb43c('0x3'));var BPromise=require(_0xb43c('0x4'));var rp=require(_0xb43c('0x5'));var attributes=require(_0xb43c('0x6'));module['exports']=function(_0x36e386,_0x28006a){return _0x36e386['define']('FaxMessage',attributes,{'tableName':_0xb43c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x18c371,_0x60e082,_0x5c4643){var _0x5eb3ce=_0x36e386[_0xb43c('0x8')];var _0x2011cd=_0x18c371['get']({'plain':!![]});if(_0x2011cd['direction'][_0xb43c('0x9')]()==='in'||_0x2011cd['direction'][_0xb43c('0x9')]()===_0xb43c('0xa')&&!_0x2011cd[_0xb43c('0xb')]&&!_[_0xb43c('0xc')](_0x2011cd[_0xb43c('0xd')])){_0x5eb3ce[_0xb43c('0xe')][_0xb43c('0xf')]({'where':{'id':_0x2011cd['FaxInteractionId']}})[_0xb43c('0x10')](function(_0x219903){if(_0x219903){_0x219903[_0xb43c('0x11')]({'lastMsgAt':_0x2011cd['createdAt'],'lastMsgDirection':_0x2011cd[_0xb43c('0x12')][_0xb43c('0x9')](),'lastMsgBody':_0x2011cd[_0xb43c('0x13')]});}})['catch'](function(_0x3ca2b6){console[_0xb43c('0x14')](_0x3ca2b6);});}_0x5c4643();}},'charset':_0xb43c('0x15'),'collate':_0xb43c('0x16')});};