fix delete user

master
tnud0 2 years ago
parent 6dfbe3b006
commit 3c9f2c8ca0
  1. 1
      package.json
  2. 1
      src/api/controllers/v1/auth.controller.js
  3. 5
      src/api/controllers/v1/user.controller.js

@ -18,7 +18,6 @@
"instrument": false "instrument": false
}, },
"scripts": { "scripts": {
"precommit": "yarn lint",
"clean": "./node_modules/.bin/rimraf dist -p", "clean": "./node_modules/.bin/rimraf dist -p",
"build": "yarn run clean && mkdir -p dist && ./node_modules/.bin/babel src -s -D -d dist", "build": "yarn run clean && mkdir -p dist && ./node_modules/.bin/babel src -s -D -d dist",
"start": "cross-env NODE_ENV=production pm2 start ./dist/index.js", "start": "cross-env NODE_ENV=production pm2 start ./dist/index.js",

@ -1,5 +1,4 @@
import { hash, compare } from 'bcryptjs';
import messages from '../../../config/messages'; import messages from '../../../config/messages';
import { hash, compare } from 'bcryptjs'; import { hash, compare } from 'bcryptjs';
import { handler as ErrorHandler } from '../../middlewares/error'; import { handler as ErrorHandler } from '../../middlewares/error';

@ -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)

Loading…
Cancel
Save