| 
						
						
						
					 | 
					 | 
					@ -1,3 +1,4 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import { hash } from 'bcryptjs'; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import { pick } from 'lodash'; | 
					 | 
					 | 
					 | 
					import { pick } from 'lodash'; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					// import httpStatus from 'http-status';
 | 
					 | 
					 | 
					 | 
					// import httpStatus from 'http-status';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import messages from '../../../config/messages'; | 
					 | 
					 | 
					 | 
					import messages from '../../../config/messages'; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -5,7 +6,6 @@ import messages from '../../../config/messages'; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import { handler as ErrorHandler } from '../../middlewares/error'; | 
					 | 
					 | 
					 | 
					import { handler as ErrorHandler } from '../../middlewares/error'; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import User from '../../../common/models/user.model'; | 
					 | 
					 | 
					 | 
					import User from '../../../common/models/user.model'; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import uploadAdapter from '../../../common/services/adapters/upload-adapter'; | 
					 | 
					 | 
					 | 
					import uploadAdapter from '../../../common/services/adapters/upload-adapter'; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import { hash } from 'bcryptjs'; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					/** | 
					 | 
					 | 
					 | 
					/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * Create | 
					 | 
					 | 
					 | 
					 * Create | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * | 
					 | 
					 | 
					 | 
					 * | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -41,6 +41,7 @@ exports.create = async (req, res, next) => { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * @returns {Promise<StorySchema[]>, APIException>} | 
					 | 
					 | 
					 | 
					 * @returns {Promise<StorySchema[]>, APIException>} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 */ | 
					 | 
					 | 
					 | 
					 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					exports.list = async (req, res, next) => { | 
					 | 
					 | 
					 | 
					exports.list = async (req, res, next) => { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    req.query.services = User.Services.USER | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    User.list( | 
					 | 
					 | 
					 | 
					    User.list( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        req.query | 
					 | 
					 | 
					 | 
					        req.query | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    ).then(result => { | 
					 | 
					 | 
					 | 
					    ).then(result => { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -75,7 +76,7 @@ exports.get = async (req, res, next) => res.json({ data: User.transform(req.loca | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					exports.update = async (req, res, next) => { | 
					 | 
					 | 
					 | 
					exports.update = async (req, res, next) => { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    const { user } = req.locals; | 
					 | 
					 | 
					 | 
					    const { user } = req.locals; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    const dataChanged =  User.getChangedProperties(req.body); | 
					 | 
					 | 
					 | 
					    const dataChanged =  User.getChangedProperties(req.body); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    let new_properties = pick(req.body, dataChanged); | 
					 | 
					 | 
					 | 
					    const new_properties = pick(req.body, dataChanged); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    // const updateUser = Object.assign(
 | 
					 | 
					 | 
					 | 
					    // const updateUser = Object.assign(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    //     user,
 | 
					 | 
					 | 
					 | 
					    //     user,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    //     pick(req.body, dataChanged)
 | 
					 | 
					 | 
					 | 
					    //     pick(req.body, dataChanged)
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |