d303cb820a79bd2dcf18b46197997e1b617ab843
[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 _0x5e23=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappInteraction','changed','format','lodash','util','../../config/logger'];(function(_0x2bde97,_0x5bc2e7){var _0x4fde78=function(_0x57e7c){while(--_0x57e7c){_0x2bde97['push'](_0x2bde97['shift']());}};_0x4fde78(++_0x5bc2e7);}(_0x5e23,0x169));var _0x35e2=function(_0x1c8a1e,_0x58717d){_0x1c8a1e=_0x1c8a1e-0x0;var _0x5815b3=_0x5e23[_0x1c8a1e];return _0x5815b3;};'use strict';var _=require(_0x35e2('0x0'));var util=require(_0x35e2('0x1'));var logger=require(_0x35e2('0x2'))('api');var moment=require(_0x35e2('0x3'));var BPromise=require(_0x35e2('0x4'));var rp=require(_0x35e2('0x5'));var fs=require('fs');var path=require(_0x35e2('0x6'));var rimraf=require(_0x35e2('0x7'));var config=require(_0x35e2('0x8'));var attributes=require('./whatsappInteraction.attributes');module[_0x35e2('0x9')]=function(_0x11e10d,_0x1e355b){return _0x11e10d['define'](_0x35e2('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x281d0f,_0x362e30,_0x34f46a){if(_0x281d0f[_0x35e2('0xb')]('closed')){_0x281d0f['closedAt']=moment()[_0x35e2('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x34f46a(null,_0x281d0f);}}});};