e9a5a1881a5476192606036cf732d43dbb748259
[motion2.git] / server / api / whatsappInteraction / whatsappInteraction.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 _0x5e60=['../../config/logger','api','bluebird','path','../../config/environment','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x4e1ef1,_0x581039){var _0x29c952=function(_0xcfe63){while(--_0xcfe63){_0x4e1ef1['push'](_0x4e1ef1['shift']());}};_0x29c952(++_0x581039);}(_0x5e60,0x179));var _0x05e6=function(_0x4dec43,_0x20789f){_0x4dec43=_0x4dec43-0x0;var _0x437f40=_0x5e60[_0x4dec43];return _0x437f40;};'use strict';var _=require('lodash');var util=require(_0x05e6('0x0'));var logger=require(_0x05e6('0x1'))(_0x05e6('0x2'));var moment=require('moment');var BPromise=require(_0x05e6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x05e6('0x4'));var rimraf=require('rimraf');var config=require(_0x05e6('0x5'));var attributes=require('./whatsappInteraction.attributes');module[_0x05e6('0x6')]=function(_0x4dfcc9,_0x52fb1f){return _0x4dfcc9['define'](_0x05e6('0x7'),attributes,{'tableName':_0x05e6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5226f1,_0x2f94bb,_0x4f71b9){if(_0x5226f1[_0x05e6('0x9')](_0x05e6('0xa'))){_0x5226f1[_0x05e6('0xb')]=moment()[_0x05e6('0xc')](_0x05e6('0xd'));}_0x4f71b9(null,_0x5226f1);}}});};