-
Notifications
You must be signed in to change notification settings - Fork 0
チャンネルに入るエンドポイントを実装 #20
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
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.
Pull Request Overview
This pull request implements an endpoint for joining a channel by enabling users to be added to channels. Key changes include:
- A new usecase method (AddUserToChannel) and corresponding handler (HandleAddUserToChannel) to support adding users to a channel.
- Updates to API specifications with the removal of the old openapi.yml and introduction of a new api/openapi.yaml.
- Addition of new tests and minor logging improvements in persistence.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
openapi.yml | Removed old API spec definitions |
api/usecase/channel.go | Added AddUserToChannel usecase method |
api/interface/handler/channel.go | Added HandleAddUserToChannel endpoint handler and updated URI parameter binding |
api/test/channel_test.go | Added tests for channel user addition endpoint |
api/openapi.yaml | Added new API spec file with updated version and endpoints |
api/infrastructure/persistence/user_channels.go | Improved logging and adjusted record lookup for user-channel relationships |
api/infrastructure/persistence/channel.go | Modified query construction for GetByID |
api/cmd/app/app.go | Updated routing to include the new channel users endpoint |
Makefile | Added test command |
Comments suppressed due to low confidence (1)
api/usecase/channel.go:70
- [nitpick] The field name 'userChannelsRespository' appears to be misspelled; consider renaming it to 'userChannelsRepository' for clarity and consistency.
userChannel, err := cu.userChannelsRespository.Insert(userID, id)
result := ccp.db.Where("user_id = ? AND channel_id = ?", userID, channelID).First(&userChannels) | ||
if err := result.Error; err != nil { | ||
if errors.Is(err, gorm.ErrRecordNotFound) { | ||
slog.Info(fmt.Sprintf("a relation between user %s and channe %s is not found.", userID, channelID)) |
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.
There is a typo in the log message: 'channe' should be corrected to 'channel'.
slog.Info(fmt.Sprintf("a relation between user %s and channe %s is not found.", userID, channelID)) | |
slog.Info(fmt.Sprintf("a relation between user %s and channel %s is not found.", userID, channelID)) |
Copilot uses AI. Check for mistakes.
#8