mirror of
https://github.com/usememos/memos.git
synced 2025-02-16 03:12:13 +01:00
fix: get all memo api (#2091)
This commit is contained in:
parent
e097e8331e
commit
5d5d8de9fe
@ -531,30 +531,13 @@ func (s *APIV1Service) registerMemoRoutes(g *echo.Group) {
|
||||
g.GET("/memo/all", func(c echo.Context) error {
|
||||
ctx := c.Request().Context()
|
||||
findMemoMessage := &store.FindMemo{}
|
||||
_, ok := c.Get(auth.UserIDContextKey).(int)
|
||||
_, ok := c.Get(auth.UserIDContextKey).(int32)
|
||||
if !ok {
|
||||
findMemoMessage.VisibilityList = []store.Visibility{store.Public}
|
||||
} else {
|
||||
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 {
|
||||
findMemoMessage.Limit = &limit
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user