-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: create expense without any group attached #68
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work, please check the mentioned things and we should be good to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work, one or two minor changes required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 6 out of 10 changed files in this pull request and generated 2 suggestions.
Files not reviewed (4)
- src/app.ts: Evaluated as low risk
- src/db/schemas/expense.model.ts: Evaluated as low risk
- src/modules/categories/category.routes.ts: Evaluated as low risk
- src/common/utils/test.util.ts: Evaluated as low risk
@sub1120 Please reduce the cognitive complexity of create expense function as suggested by the code quality check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 6 out of 8 changed files in this pull request and generated 2 suggestions.
Files not reviewed (2)
- src/app.ts: Evaluated as low risk
- src/modules/expenses/expense.routes.ts: Evaluated as low risk
Comments skipped due to low confidence (3)
src/modules/expenses/expense.handlers.ts:63
- The error message has a grammatical error. It should be 'Category does not belong to user'.
message: "Category does not belongs to user",
src/modules/expenses/expense.handlers.ts:76
- There is no test coverage for the case where the
db.insert
operation increateExpenseRepository
fails.
expense = await createExpenseRepository(expensePayload);
src/modules/expenses/expense.repository.ts:6
- [nitpick] The type alias
TExpensePayload
could be more descriptive. It should be renamed toCreateExpensePayload
to better reflect its purpose.
type TExpensePayload = Omit<TInsertExpenseSchema, "id" | "createdAt" | "updatedAt" | "groupId" >;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 9 out of 9 changed files in this pull request and generated no suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things got updated, please make those changes accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the correct error message
success: z.boolean().default(false), | ||
message: z.string(), | ||
}), | ||
VALIDATION_ERROR_MESSAGE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not found should not be same as validation error, please check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shivamvijaywargi i updated error message to Not found error(s)
. Works?

And thank you for getting my attention to "Not Found" status, with this i got to know some mistakes in test cases related to 404. I have fixed them as well. 5ae08b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "Requested resource not found"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya this is good. I will update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 6 out of 9 changed files in this pull request and generated no suggestions.
Files not reviewed (3)
- src/app.ts: Evaluated as low risk
- src/db/schemas/expense.model.ts: Evaluated as low risk
- src/modules/categories/category.util.ts: Evaluated as low risk
Please fix the cognitive complexity, best thing would be to refactor your switch case to its own function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 6 out of 10 changed files in this pull request and generated no suggestions.
Files not reviewed (4)
- src/modules/expenses/expense.routes.ts: Evaluated as low risk
- src/modules/expenses/expense.test.ts: Evaluated as low risk
- src/common/utils/constants.ts: Evaluated as low risk
- src/db/schemas/expense.model.ts: Evaluated as low risk
Comments skipped due to low confidence (1)
src/modules/expenses/expense.handlers.ts:68
- [nitpick] The error message 'Category does not belong to valid category user' could be more specific. Consider changing it to 'Category does not belong to the user or the specified payer'.
message: "Category does not belong to valid category user",
@shivamvijaywargi I’ve refactored the code. In my opinion, extracting switch case to its own function would definitely improve the complexity score, though I’m still a bit uncertain about how the function might evolve when we implement updates to the create expense feature for handling splits. So for now, following our discussion on category validation, I created a separate function to validate category, which has further reduced complexity. Let me know your thoughts! |
This Node.js CI build is failing because of eslint errors in ISSUE_TEAMPLATES which we recently added, should we add .github/ISSUE_TEMPLATES to eslint ignore? |
Yes, let's add it. |
Please ignore the issues template from ESLint and we can ship this. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 6 out of 10 changed files in this pull request and generated no suggestions.
Files not reviewed (4)
- src/db/schemas/expense.model.ts: Evaluated as low risk
- src/modules/expenses/expense.repository.ts: Evaluated as low risk
- src/common/utils/constants.ts: Evaluated as low risk
- src/app.ts: Evaluated as low risk
In this PR, i have created expense without considering group.
I have a created another Issue to work on expense considering group related scenarios - #66 .