Skip to content

Commit 4acaba5

Browse files
add swagger docs
1 parent 2f2eff1 commit 4acaba5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

internal/handlers/post.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,14 @@ func (h *PostHandler) ListAllPosts(c *gin.Context) {
252252
c.JSON(http.StatusOK, gin.H{"posts": posts})
253253
}
254254

255+
// @Summary List public posts
256+
// @Description Retrieve all posts from public clubs
257+
// @Tags Posts
258+
// @Accept json
259+
// @Produce json
260+
// @Success 200 {array} models.Post "Public posts retrieved successfully"
261+
// @Failure 500 {object} gin.H "Internal server error"
262+
// @Router /posts/public [get]
255263
func (h *PostHandler) ListPublicPosts(c *gin.Context) {
256264
posts, err := h.postService.ListPublicPosts()
257265
if err != nil {
@@ -262,6 +270,14 @@ func (h *PostHandler) ListPublicPosts(c *gin.Context) {
262270
c.JSON(http.StatusOK, gin.H{"posts": posts})
263271
}
264272

273+
// @Summary List popular public posts
274+
// @Description Retrieve popular posts from public clubs based on number of likes
275+
// @Tags Posts
276+
// @Accept json
277+
// @Produce json
278+
// @Success 200 {array} models.Post "Popular public posts retrieved successfully"
279+
// @Failure 500 {object} gin.H "Internal server error"
280+
// @Router /posts/popular [get]
265281
func (h *PostHandler) ListPopularPublicPosts(c *gin.Context) {
266282
posts, err := h.postService.ListPopularPublicPosts(20)
267283
if err != nil {

0 commit comments

Comments
 (0)