8327994ef86d62c61f0bfa4a2732962cfae2847f
[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 _0x0f28=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','path','../../config/environment','exports','define','chat_interactions','closedAt'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0f28,0x170));var _0x80f2=function(_0x52980f,_0x47b3b0){_0x52980f=_0x52980f-0x0;var _0x1f52a1=_0x0f28[_0x52980f];return _0x1f52a1;};'use strict';var _=require(_0x80f2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x80f2('0x1'));var moment=require(_0x80f2('0x2'));var BPromise=require(_0x80f2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80f2('0x4'));var rimraf=require('rimraf');var config=require(_0x80f2('0x5'));var attributes=require('./chatInteraction.attributes');module[_0x80f2('0x6')]=function(_0x279862,_0x4a47e3){return _0x279862[_0x80f2('0x7')]('ChatInteraction',attributes,{'tableName':_0x80f2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4a299c,_0x236dc5,_0x22cf2c){if(_0x4a299c['changed']('closed')){_0x4a299c[_0x80f2('0x9')]=moment()[_0x80f2('0xa')](_0x80f2('0xb'));}_0x22cf2c(null,_0x4a299c);}},'charset':_0x80f2('0xc'),'collate':_0x80f2('0xd')});};