8000 チャンネルに入るエンドポイントを実装 by keito0tada · Pull Request #20 · comb19/chat_back · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

チャンネルに入るエンドポイントを実装 #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

Merged
merged 6 commits into from
May 11, 2025

Conversation

keito0tada
Copy link
Contributor
@keito0tada keito0tada commented May 10, 2025

#8

@keito0tada keito0tada requested a review from kasatomorning May 10, 2025 19:40
@keito0tada keito0tada self-assigned this May 10, 2025
@keito0tada keito0tada merged commit 21bff59 into develop May 11, 2025
@kasatomorning kasatomorning requested a review from Copilot May 11, 2025 10:02
Copy link
@Copilot Copilot AI left a 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))
Copy link
Preview
Copilot AI May 11, 2025

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'.

Suggested change
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.

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.

1 participant
0