Skip to content

Commit

Permalink
refatoração - lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dopimentel committed Feb 21, 2024
1 parent d9d4903 commit 202638e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ app.use(express.json());

app.post('/login', loginController);
app.post('/user', userController.create);
app.get('/user', auth, userController.getAll);
app.get('/user', auth, userController.getAll);
app.get('/user/:id', auth, userController.getById);

app.use(error);
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/loginController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { loginService } = require('../services');

const loginController = async (req, res, next) => {
const { email, password } = req.body;
const response = await loginService( { email, password });
const response = await loginService({ email, password });
if (response.error) return next(response.error);
if (response.status === 400) {
const err = new Error(response.message);
Expand All @@ -12,4 +12,4 @@ const loginController = async (req, res, next) => {
res.status(200).json({ token: response.token });
};

module.exports = loginController
module.exports = loginController;
4 changes: 2 additions & 2 deletions src/controllers/userController.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ const create = async (req, res, next) => {
return next(err);
}

res.status(response.status).json({ token: response.token});
res.status(response.status).json({ token: response.token });
};

const getAll = async (req, res, next) => {
const getAll = async (req, res) => {
const users = await userService.getAll();
res.status(200).json(users);
};
Expand Down
1 change: 1 addition & 0 deletions src/services/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const userService = require('./userService');
const loginService = require('./loginService');

module.exports = {
userService,
loginService,
Expand Down
2 changes: 1 addition & 1 deletion src/services/loginService.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ const loginService = async ({ email, password }) => {
};
};

module.exports = loginService
module.exports = loginService;

0 comments on commit 202638e

Please sign in to comment.