fixed issue with user creation
This commit is contained in:
		| @ -1,6 +1,6 @@ | |||||||
| 'use strict'; | 'use strict'; | ||||||
|  |  | ||||||
| const Host = new require('../utils/redis_model')({ | const Host = require('../utils/redis_model')({ | ||||||
| 	_name: 'host', | 	_name: 'host', | ||||||
| 	_key: 'host', | 	_key: 'host', | ||||||
| 	_keyMap: { | 	_keyMap: { | ||||||
|  | |||||||
| @ -15,6 +15,8 @@ router.get('/', async function(req, res, next){ | |||||||
|  |  | ||||||
| router.post('/', async function(req, res, next){ | router.post('/', async function(req, res, next){ | ||||||
| 	try{ | 	try{ | ||||||
|  | 		req.body.created_by = req.user.username | ||||||
|  |  | ||||||
| 		return res.json({results: await User.add(req.body)}); | 		return res.json({results: await User.add(req.body)}); | ||||||
| 	}catch(error){ | 	}catch(error){ | ||||||
| 		next(error); | 		next(error); | ||||||
|  | |||||||
| @ -177,14 +177,6 @@ table.remove = async function(data){ | |||||||
| 	} | 	} | ||||||
| }; | }; | ||||||
|  |  | ||||||
| table.createInstance = function(data){ |  | ||||||
|  |  | ||||||
| 	// this.__proto__ = data; |  | ||||||
|  |  | ||||||
| 	return this |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| function Table(data){ | function Table(data){ | ||||||
| 	// Create a table instance. | 	// Create a table instance. | ||||||
| 	let instance = Object.create(data); | 	let instance = Object.create(data); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user