-
Notifications
You must be signed in to change notification settings - Fork 0
Implement goal service #32
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
base: feat/Delete
Are you sure you want to change the base?
Conversation
Changelist by BitoThis pull request implements the following key changes.
|
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.
Code Review Agent Run #463da1
Actionable Suggestions - 3
-
internal/app/goal/service.go - 1
- Incorrect error return on success · Line 56-56
-
internal/app/transaction/domain.go - 1
- Missing database struct tags break sqlx operations · Line 6-14
-
internal/repository/goal.go - 1
- Incorrect error handling for empty results · Line 98-98
Review Details
-
Files reviewed - 14 · Commit Range:
a1b4689..4db322e- internal/app/dependencies.go
- internal/app/goal/domain.go
- internal/app/goal/handler.go
- internal/app/goal/service.go
- internal/app/router.go
- internal/app/transaction/domain.go
- internal/app/user/domain.go
- internal/app/user/handler.go
- internal/app/user/service.go
- internal/pkg/apperrors/errors.go
- internal/repository/contribution.go
- internal/repository/domain.go
- internal/repository/goal.go
- internal/repository/user.go
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at vishwajeetsingh@joshsoftware.com.
Documentation & Help
| return 0, err | ||
| } | ||
|
|
||
| return goalId, err |
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.
The GetGoalIdByGoalLevel function returns err instead of nil on successful execution. This will cause the function to always return an error, breaking all callers. Change return goalId, err to return goalId, nil.
Code suggestion
Check the AI-generated fix before applying
| return goalId, err | |
| return goalId, nil |
Code Review Run #463da1
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
| Id int | ||
| UserId int | ||
| ContributionId int | ||
| IsRedeemed bool | ||
| IsGained bool | ||
| TransactedBalance int | ||
| TransactedAt time.Time | ||
| CreatedAt time.Time | ||
| UpdatedAt time.Time |
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.
The db struct tags have been removed from all Transaction struct fields. This will break database operations since the repository layer uses sqlx.GetContext() which relies on these tags to map database columns to struct fields. Please restore all db tags: db:"id", db:"user_id", db:"contribution_id", db:"is_redeemed", db:"is_gained", db:"transacted_balance", db:"transacted_at", db:"created_at", db:"updated_at".
Code suggestion
Check the AI-generated fix before applying
| Id int | |
| UserId int | |
| ContributionId int | |
| IsRedeemed bool | |
| IsGained bool | |
| TransactedBalance int | |
| TransactedAt time.Time | |
| CreatedAt time.Time | |
| UpdatedAt time.Time | |
| Id int `db:"id"` | |
| UserId int `db:"user_id"` | |
| ContributionId int `db:"contribution_id"` | |
| IsRedeemed bool `db:"is_redeemed"` | |
| IsGained bool `db:"is_gained"` | |
| TransactedBalance int `db:"transacted_balance"` | |
| TransactedAt time.Time `db:"transacted_at"` | |
| CreatedAt time.Time `db:"created_at"` | |
| UpdatedAt time.Time `db:"updated_at"` |
Code Review Run #463da1
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
| } | ||
|
|
||
| slog.Error("error occured while getting goal id by goal level", "error", err) | ||
| return nil, apperrors.ErrInternalServer |
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.
The ListUserGoalLevelTargets function incorrectly handles sql.ErrNoRows by returning ErrInternalServer. For SelectContext operations, no rows is a valid scenario that should return an empty slice []GoalContribution{} instead of an error. This will cause incorrect 500 errors when users have no goal level targets.
Code suggestion
Check the AI-generated fix before applying
| return nil, apperrors.ErrInternalServer | |
| return []GoalContribution{}, nil |
Code Review Run #463da1
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
Summary by Bito
This pull request implements a new goal service enabling users to set goal levels, view targets, and create custom targets. It introduces domain models, service logic, API endpoints, and repository methods for goal management while enhancing the user service to support updating active goals. The changes integrate seamlessly with existing components and improve error handling.