720876042daacfbd826eb3f67d1142d59c95c9ac
[motion2.git] / server / api / userProfile / userProfile.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 _0x7af2=['request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','user_profiles','models','User','privacyEnabled','util','../../config/logger','api','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7af2,0x119));var _0x27af=function(_0xe397b4,_0x37f1c0){_0xe397b4=_0xe397b4-0x0;var _0x384f1e=_0x7af2[_0xe397b4];return _0x384f1e;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var logger=require(_0x27af('0x1'))(_0x27af('0x2'));var moment=require(_0x27af('0x3'));var BPromise=require('bluebird');var rp=require(_0x27af('0x4'));var fs=require('fs');var path=require(_0x27af('0x5'));var rimraf=require(_0x27af('0x6'));var config=require(_0x27af('0x7'));var attributes=require(_0x27af('0x8'));module[_0x27af('0x9')]=function(_0x350532,_0x184630){return _0x350532[_0x27af('0xa')]('UserProfile',attributes,{'tableName':_0x27af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x366868,_0x389e97,_0x583db8){var _0x369a20=_0x350532[_0x27af('0xc')];_0x369a20[_0x27af('0xd')]['update']({'privacyEnabled':_0x366868[_0x27af('0xe')]},{'where':{'UserProfileId':_0x366868['id']}})['then'](function(){_0x583db8();})['catch'](function(_0x3e4b33){_0x583db8(_0x3e4b33);});}}});};