7d4e22d193fee3ffe0121682b0d13cd9ab5a0861
[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 _0x5cdf=['WhatsappInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x496997,_0x5a576c){var _0x3d16b2=function(_0x7cb3e7){while(--_0x7cb3e7){_0x496997['push'](_0x496997['shift']());}};_0x3d16b2(++_0x5a576c);}(_0x5cdf,0x17d));var _0xf5cd=function(_0x21d9c7,_0x5ea2f6){_0x21d9c7=_0x21d9c7-0x0;var _0x648b6e=_0x5cdf[_0x21d9c7];return _0x648b6e;};'use strict';var _=require(_0xf5cd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf5cd('0x1'));var BPromise=require(_0xf5cd('0x2'));var rp=require(_0xf5cd('0x3'));var fs=require('fs');var path=require(_0xf5cd('0x4'));var rimraf=require(_0xf5cd('0x5'));var config=require(_0xf5cd('0x6'));var attributes=require('./whatsappInteraction.attributes');module[_0xf5cd('0x7')]=function(_0x292b65,_0x244cab){return _0x292b65[_0xf5cd('0x8')](_0xf5cd('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x18c6e7,_0x163a29,_0x2c2cdc){if(_0x18c6e7[_0xf5cd('0xa')]('closed')){_0x18c6e7['closedAt']=moment()[_0xf5cd('0xb')](_0xf5cd('0xc'));}_0x2c2cdc(null,_0x18c6e7);}}});};