Skip to content

Commit

Permalink
feat: req08
Browse files Browse the repository at this point in the history
  • Loading branch information
dopimentel committed Feb 21, 2024
1 parent fd08d10 commit cecdace
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const express = require('express');
const { loginController, userController } = require('./controllers');
const { loginController, userController, categoryController } = require('./controllers');
const { error, auth } = require('./middlewares');

const app = express();
Expand All @@ -14,6 +14,7 @@ app.post('/login', loginController);
app.post('/user', userController.create);
app.get('/user', auth, userController.getAll);
app.get('/user/:id', auth, userController.getById);
app.post('/categories', auth, categoryController.create);

app.use(error);

Expand Down
2 changes: 2 additions & 0 deletions src/controllers/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const userController = require('./userController');
const loginController = require('./loginController');
const categoryController = require('./categoryController');

module.exports = {
userController,
loginController,
categoryController,
};
2 changes: 2 additions & 0 deletions src/services/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const userService = require('./userService');
const loginService = require('./loginService');
const categoryService = require('./categoryService');

module.exports = {
userService,
loginService,
categoryService,
};
2 changes: 2 additions & 0 deletions src/services/validations/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const loginValidation = require('./loginValidation');
const createUserValidation = require('./createUserValidation');
const createCategoryValidation = require('./createCategoryValidation');

module.exports = {
loginValidation,
createUserValidation,
createCategoryValidation,
};
5 changes: 5 additions & 0 deletions src/utils/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ const createUserSchema = Joi.object({

});

const createCategorySchema = Joi.object({
name: Joi.string().required(),
});

module.exports = {
loginSchema,
createUserSchema,
createCategorySchema,
};

0 comments on commit cecdace

Please sign in to comment.