Skip to content

Commit

Permalink
chore: comment unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
fmartingr committed Oct 29, 2023
1 parent f16dd42 commit 1d58455
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions internal/http/routes/bookmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,42 +27,42 @@ func (r *BookmarkRoutes) Setup(group *gin.RouterGroup) model.Routes {
return r
}

func (r *BookmarkRoutes) bookmarkContentHandler(c *gin.Context) {
ctx := context.NewContextFromGin(c)

bookmarkIDParam, present := c.Params.Get("id")
if !present {
response.SendError(c, 400, "Invalid bookmark ID")
return
}

bookmarkID, err := strconv.Atoi(bookmarkIDParam)
if err != nil {
r.logger.WithError(err).Error("error parsing bookmark ID parameter")
response.SendInternalServerError(c)
return
}

if bookmarkID == 0 {
response.SendError(c, 404, nil)
return
}

bookmark, found, err := r.deps.Database.GetBookmark(c, bookmarkID, "")
if err != nil || !found {
response.SendError(c, 404, nil)
return
}

if bookmark.Public != 1 && !ctx.UserIsLogged() {
response.SendError(c, http.StatusForbidden, nil)
return
}

response.Send(c, 200, bookmark.Content)
}

func (r *BookmarkRoutes) bookmarkArchiveHandler(c *gin.Context) {}
// func (r *BookmarkRoutes) bookmarkContentHandler(c *gin.Context) {
// ctx := context.NewContextFromGin(c)

// bookmarkIDParam, present := c.Params.Get("id")
// if !present {
// response.SendError(c, 400, "Invalid bookmark ID")
// return
// }

// bookmarkID, err := strconv.Atoi(bookmarkIDParam)
// if err != nil {
// r.logger.WithError(err).Error("error parsing bookmark ID parameter")
// response.SendInternalServerError(c)
// return
// }

// if bookmarkID == 0 {
// response.SendError(c, 404, nil)
// return
// }

// bookmark, found, err := r.deps.Database.GetBookmark(c, bookmarkID, "")
// if err != nil || !found {
// response.SendError(c, 404, nil)
// return
// }

// if bookmark.Public != 1 && !ctx.UserIsLogged() {
// response.SendError(c, http.StatusForbidden, nil)
// return
// }

// response.Send(c, 200, bookmark.Content)
// }

// func (r *BookmarkRoutes) bookmarkArchiveHandler(c *gin.Context) {}

func NewBookmarkRoutes(logger *logrus.Logger, deps *config.Dependencies) *BookmarkRoutes {
return &BookmarkRoutes{
Expand Down

0 comments on commit 1d58455

Please sign in to comment.