Skip to content

Commit b1fd373

Browse files
fix: conflicting post endpoints
1 parent b8e2361 commit b1fd373

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

internal/handlers/post.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ func (h *PostHandler) ListAllPosts(c *gin.Context) {
262262
// @Param offset query int false "Number of posts to skip" default(0)
263263
// @Success 200 {array} models.PostSummary "Post summaries retrieved successfully"
264264
// @Failure 500 {object} models.ErrorResponse
265-
// @Router /posts/summaries [get]
265+
// @Router /clubs/{id}/posts/summaries [get]
266266
func (h *PostHandler) ListPostSummaries(c *gin.Context) {
267-
clubIDParam := c.Param("club_id")
267+
clubIDParam := c.Param("id")
268268
clubID, err := strconv.ParseUint(clubIDParam, 10, 32)
269269
if err != nil {
270270
c.JSON(http.StatusBadRequest, gin.H{"error": "invalid club ID"})

internal/handlers/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (s *Server) setupRoutes() {
128128

129129
api.GET("/posts/:id/likes", postHandler.ListLikesByPostID)
130130
api.GET("/posts", postHandler.ListAllPosts)
131-
api.GET("/posts/:club_id/summaries", postHandler.ListPostSummaries)
131+
api.GET("/clubs/:id/posts/summaries", postHandler.ListPostSummaries)
132132
api.GET("/posts/:id", postHandler.GetPostByID)
133133

134134
api.GET("/posts/:id/comments", commentHandler.ListCommentsByPostID)

0 commit comments

Comments
 (0)