7773ac30ed081cd8aef675e9a167417ea13ddc06
[motion2.git] / server / api / smsInteraction / smsInteraction.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 _0x7e24=['define','SmsInteraction','sms_interactions','changed','closedAt','format','lodash','util','api','bluebird','request-promise','path','rimraf','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7e24,0x1e2));var _0x47e2=function(_0x3206b0,_0x343e73){_0x3206b0=_0x3206b0-0x0;var _0x555be5=_0x7e24[_0x3206b0];return _0x555be5;};'use strict';var _=require(_0x47e2('0x0'));var util=require(_0x47e2('0x1'));var logger=require('../../config/logger')(_0x47e2('0x2'));var moment=require('moment');var BPromise=require(_0x47e2('0x3'));var rp=require(_0x47e2('0x4'));var fs=require('fs');var path=require(_0x47e2('0x5'));var rimraf=require(_0x47e2('0x6'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0x47e2('0x7')]=function(_0x1f6e7a,_0x4f7a10){return _0x1f6e7a[_0x47e2('0x8')](_0x47e2('0x9'),attributes,{'tableName':_0x47e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2515f6,_0x263dd3,_0x4ad93f){if(_0x2515f6[_0x47e2('0xb')]('closed')){_0x2515f6[_0x47e2('0xc')]=moment()[_0x47e2('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4ad93f(null,_0x2515f6);}}});};