0b9cbacdeeafa56b18dc221246dacd1f8a071780
[motion2.git] / server / api / chatInteraction / chatInteraction.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 _0x2fbf=['rimraf','./chatInteraction.attributes','exports','ChatInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path'];(function(_0x23d309,_0x14d6fc){var _0x18f608=function(_0x96cdd7){while(--_0x96cdd7){_0x23d309['push'](_0x23d309['shift']());}};_0x18f608(++_0x14d6fc);}(_0x2fbf,0x1ae));var _0xf2fb=function(_0x4e1158,_0x4366c6){_0x4e1158=_0x4e1158-0x0;var _0x3eaa89=_0x2fbf[_0x4e1158];return _0x3eaa89;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf2fb('0x0'))(_0xf2fb('0x1'));var moment=require(_0xf2fb('0x2'));var BPromise=require('bluebird');var rp=require(_0xf2fb('0x3'));var fs=require('fs');var path=require(_0xf2fb('0x4'));var rimraf=require(_0xf2fb('0x5'));var config=require('../../config/environment');var attributes=require(_0xf2fb('0x6'));module[_0xf2fb('0x7')]=function(_0x4ad3a6,_0x8eacc6){return _0x4ad3a6['define'](_0xf2fb('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2dcc8d,_0x2396cd,_0xcd379f){if(_0x2dcc8d[_0xf2fb('0x9')](_0xf2fb('0xa'))){_0x2dcc8d['closedAt']=moment()[_0xf2fb('0xb')](_0xf2fb('0xc'));}_0xcd379f(null,_0x2dcc8d);}},'charset':_0xf2fb('0xd'),'collate':_0xf2fb('0xe')});};