Unverified Commit 5d5d8de9 authored by boojack's avatar boojack Committed by GitHub

fix: get all memo api (#2091)

parent e097e833
...@@ -531,30 +531,13 @@ func (s *APIV1Service) registerMemoRoutes(g *echo.Group) { ...@@ -531,30 +531,13 @@ func (s *APIV1Service) registerMemoRoutes(g *echo.Group) {
g.GET("/memo/all", func(c echo.Context) error { g.GET("/memo/all", func(c echo.Context) error {
ctx := c.Request().Context() ctx := c.Request().Context()
findMemoMessage := &store.FindMemo{} findMemoMessage := &store.FindMemo{}
_, ok := c.Get(auth.UserIDContextKey).(int) _, ok := c.Get(auth.UserIDContextKey).(int32)
if !ok { if !ok {
findMemoMessage.VisibilityList = []store.Visibility{store.Public} findMemoMessage.VisibilityList = []store.Visibility{store.Public}
} else { } else {
findMemoMessage.VisibilityList = []store.Visibility{store.Public, store.Protected} findMemoMessage.VisibilityList = []store.Visibility{store.Public, store.Protected}
} }
pinnedStr := c.QueryParam("pinned")
if pinnedStr != "" {
pinned := pinnedStr == "true"
findMemoMessage.Pinned = &pinned
}
contentSearch := []string{}
tag := c.QueryParam("tag")
if tag != "" {
contentSearch = append(contentSearch, "#"+tag+" ")
}
contentSlice := c.QueryParams()["content"]
if len(contentSlice) > 0 {
contentSearch = append(contentSearch, contentSlice...)
}
findMemoMessage.ContentSearch = contentSearch
if limit, err := strconv.Atoi(c.QueryParam("limit")); err == nil { if limit, err := strconv.Atoi(c.QueryParam("limit")); err == nil {
findMemoMessage.Limit = &limit findMemoMessage.Limit = &limit
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment