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

チャンネルの取得 API のアップデート #66

Merged
merged 13 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

func GetChannels(ctx *gin.Context) {
serverId, err := strconv.Atoi(ctx.Param("id"))
serverId, err := strconv.Atoi(ctx.Param("serverId"))
if err != nil {
ctx.JSON(http.StatusBadRequest, err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion backend/timeline/internal/middleware/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func SetupRoutes(app *gin.Engine) {
authorized.Use(Auth())
{
authorized.GET("/servers", controllers.GetServers)
authorized.GET("/servers/:id/channels", controllers.GetChannels)
authorized.GET("/servers/:serverId/channels", controllers.GetChannels)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

panic: ':serverId' in new path '/servers/:serverId/channels/:channelId/posts' conflicts with existing wildcard ':id' in existing prefix '/servers/:id'

投稿などで 2つ id を管理する場合、このエラーでこけることがあったため、分けられるようにする。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

authorized.POST("/servers/:id/channels", controllers.CreateChannels)
authorized.GET("/channels/:id/posts", controllers.GetPosts)
authorized.POST("/channels/:id/posts", controllers.CreatePost)
Expand Down
Loading