Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solution #260

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

solution #260

wants to merge 5 commits into from

Conversation

yanamomot
Copy link

No description provided.

Copy link

@DanilWeda DanilWeda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job.
I left some minor comments for fix.
Thanks)

const { userId, categories, from, to } = req.query;
const all = await expensesService.getAll(+userId, categories, from, to);

return res.status(200).send(all);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can move All status to constants

const get = async (req, res) => {
try {
const { userId, categories, from, to } = req.query;
const all = await expensesService.getAll(+userId, categories, from, to);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const all = await expensesService.getAll(+userId, categories, from, to);
const all = await expensesService.getAll(Number(userId), categories, from, to);

as alternative

const expensesRoute = express.Router();
const controller = require('../controllers/expenses.controller');

expensesRoute.get('/', controller.get);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can move all routes to constants


const usersRoute = express.Router();

usersRoute.get('/', controller.get);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, in this place

@yanamomot yanamomot requested a review from DanilWeda July 10, 2024 13:15
Copy link

@DanilWeda DanilWeda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job.
All good, but you have duplication.
I left comment, but approved your solution.
Thanks)

Comment on lines +4 to +8
const HTTP_OK = 200;
const HTTP_BAD_REQUEST = 400;
const HTTP_NOT_FOUND = 404;
const HTTP_NO_CONTENT = 204;
const HTTP_CREATED = 201;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can move all constants in separate file ( because you have duplication)

Comment on lines +3 to +7
const HTTP_OK = 200;
const HTTP_BAD_REQUEST = 400;
const HTTP_NOT_FOUND = 404;
const HTTP_NO_CONTENT = 204;
const HTTP_CREATED = 201;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can move all constants in separate file ( because you have duplication)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants