From 3c9f2c8ca04af76289856f6bf84fed8a3dce3d5d Mon Sep 17 00:00:00 2001 From: tnud0 <2001040219@s.hanu.edu.vn> Date: Wed, 10 May 2023 16:24:15 +0700 Subject: [PATCH] fix delete user --- package.json | 1 - src/api/controllers/v1/auth.controller.js | 1 - src/api/controllers/v1/user.controller.js | 5 +++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 977454c..db4786d 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "instrument": false }, "scripts": { - "precommit": "yarn lint", "clean": "./node_modules/.bin/rimraf dist -p", "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", diff --git a/src/api/controllers/v1/auth.controller.js b/src/api/controllers/v1/auth.controller.js index dcd426f..5b945c2 100644 --- a/src/api/controllers/v1/auth.controller.js +++ b/src/api/controllers/v1/auth.controller.js @@ -1,5 +1,4 @@ -import { hash, compare } from 'bcryptjs'; import messages from '../../../config/messages'; import { hash, compare } from 'bcryptjs'; import { handler as ErrorHandler } from '../../middlewares/error'; diff --git a/src/api/controllers/v1/user.controller.js b/src/api/controllers/v1/user.controller.js index 96d14cd..f79ec62 100644 --- a/src/api/controllers/v1/user.controller.js +++ b/src/api/controllers/v1/user.controller.js @@ -1,3 +1,4 @@ +import { hash } from 'bcryptjs'; import { pick } from 'lodash'; // import httpStatus from 'http-status'; import messages from '../../../config/messages'; @@ -5,7 +6,6 @@ import messages from '../../../config/messages'; import { handler as ErrorHandler } from '../../middlewares/error'; import User from '../../../common/models/user.model'; import uploadAdapter from '../../../common/services/adapters/upload-adapter'; -import { hash } from 'bcryptjs'; /** * Create * @@ -41,6 +41,7 @@ exports.create = async (req, res, next) => { * @returns {Promise, APIException>} */ exports.list = async (req, res, next) => { + req.query.services = User.Services.USER User.list( req.query ).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) => { const { user } = req.locals; const dataChanged = User.getChangedProperties(req.body); - let new_properties = pick(req.body, dataChanged); + const new_properties = pick(req.body, dataChanged); // const updateUser = Object.assign( // user, // pick(req.body, dataChanged)