2681640a6e2e8cfc351db89f282f712124f74402
[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 _0x7b70=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0x7b70,0x102));var _0x07b7=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x7b70[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0x07b7('0x0'));var util=require(_0x07b7('0x1'));var logger=require(_0x07b7('0x2'))(_0x07b7('0x3'));var moment=require('moment');var BPromise=require(_0x07b7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07b7('0x5'));var rimraf=require('rimraf');var config=require(_0x07b7('0x6'));var attributes=require(_0x07b7('0x7'));module[_0x07b7('0x8')]=function(_0x14e3db,_0x23c560){return _0x14e3db['define'](_0x07b7('0x9'),attributes,{'tableName':_0x07b7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5ac65f,_0x36fdbd,_0x12d085){if(_0x5ac65f['changed'](_0x07b7('0xb'))){_0x5ac65f['closedAt']=moment()[_0x07b7('0xc')](_0x07b7('0xd'));}_0x12d085(null,_0x5ac65f);}},'charset':_0x07b7('0xe'),'collate':_0x07b7('0xf')});};