e95607e4a5d392eacd8bd53709b519f8003a783f
[motion2.git] / server / api / cmCustomField / cmCustomField.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 _0x1e94=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','get','TEXT','transaction','type','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2a8d41,_0x5ec405){var _0x960a0f=function(_0x46cc14){while(--_0x46cc14){_0x2a8d41['push'](_0x2a8d41['shift']());}};_0x960a0f(++_0x5ec405);}(_0x1e94,0xf3));var _0x41e9=function(_0x1767d2,_0x3f7131){_0x1767d2=_0x1767d2-0x0;var _0x41646d=_0x1e94[_0x1767d2];return _0x41646d;};'use strict';var _=require(_0x41e9('0x0'));var util=require(_0x41e9('0x1'));var logger=require(_0x41e9('0x2'))(_0x41e9('0x3'));var moment=require(_0x41e9('0x4'));var BPromise=require(_0x41e9('0x5'));var rp=require(_0x41e9('0x6'));var fs=require('fs');var path=require(_0x41e9('0x7'));var rimraf=require(_0x41e9('0x8'));var config=require(_0x41e9('0x9'));var attributes=require(_0x41e9('0xa'));module[_0x41e9('0xb')]=function(_0x1af847,_0x16a644){return _0x1af847[_0x41e9('0xc')](_0x41e9('0xd'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x7c27bd,_0x384c18,_0x3d9434){var _0x4c3b47=_0x7c27bd[_0x41e9('0xe')]({'plain':!![]});var _0x298372={'type':_0x16a644[_0x41e9('0xf')],'transaction':_0x384c18[_0x41e9('0x10')]};switch(_0x4c3b47[_0x41e9('0x11')]){case _0x41e9('0x12'):_0x298372[_0x41e9('0x11')]=_0x16a644[_0x41e9('0xf')];break;case _0x41e9('0x13'):_0x298372['type']=_0x16a644[_0x41e9('0x14')];break;case _0x41e9('0x15'):_0x298372['type']=_0x16a644[_0x41e9('0x16')];_0x298372[_0x41e9('0x17')]=![];break;}_0x1af847['queryInterface'][_0x41e9('0x18')](_0x41e9('0x19'),util[_0x41e9('0x1a')](_0x41e9('0x1b'),_0x4c3b47['id']),_0x298372);_0x3d9434();}}});};