Built motion from commit (unavailable).|2.5.23
[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 _0xaa60=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','createdAt','catch','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaa60,0x151));var _0x0aa6=function(_0x3f5c98,_0x3e8a80){_0x3f5c98=_0x3f5c98-0x0;var _0x6be7fa=_0xaa60[_0x3f5c98];return _0x6be7fa;};'use strict';var _=require(_0x0aa6('0x0'));var util=require(_0x0aa6('0x1'));var logger=require(_0x0aa6('0x2'))(_0x0aa6('0x3'));var moment=require('moment');var BPromise=require(_0x0aa6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0aa6('0x5'));var rimraf=require('rimraf');var config=require(_0x0aa6('0x6'));var attributes=require(_0x0aa6('0x7'));module[_0x0aa6('0x8')]=function(_0x8ed564,_0x5df586){return _0x8ed564[_0x0aa6('0x9')](_0x0aa6('0xa'),attributes,{'tableName':_0x0aa6('0xb'),'paranoid':![],'indexes':[{'name':_0x0aa6('0xc'),'fields':[_0x0aa6('0xd')],'type':_0x0aa6('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xaef3f1,_0x149e57,_0x9643bb){var _0x47e42e=_0x8ed564[_0x0aa6('0xf')];var _0x31c701=_0xaef3f1['get']({'plain':!![]});if(_0x31c701[_0x0aa6('0x10')][_0x0aa6('0x11')]()==='in'||_0x31c701[_0x0aa6('0x10')][_0x0aa6('0x11')]()==='out'&&!_0x31c701[_0x0aa6('0x12')]&&!_[_0x0aa6('0x13')](_0x31c701[_0x0aa6('0x14')])){_0x47e42e[_0x0aa6('0x15')]['findOne']({'where':{'id':_0x31c701[_0x0aa6('0x16')]}})[_0x0aa6('0x17')](function(_0x4de280){if(_0x4de280){_0x4de280['update']({'lastMsgAt':_0x31c701[_0x0aa6('0x18')],'lastMsgDirection':_0x31c701[_0x0aa6('0x10')]['toLowerCase']()});}})[_0x0aa6('0x19')](function(_0x5e8e1a){console[_0x0aa6('0x1a')](_0x5e8e1a);});}_0x9643bb();}},'charset':'utf8mb4','collate':_0x0aa6('0x1b')});};