chore: find memo by tag (#74)

pull/75/head
STEVEN 3 years ago committed by GitHub
parent 8df0711f80
commit 164873b344
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -42,7 +42,8 @@ type MemoFind struct {
CreatorID *int `json:"creatorId"`
// Domain specific fields
Pinned *bool
Pinned *bool
Tag *string
}
type MemoDelete struct {

@ -75,6 +75,10 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
pinned := pinnedStr == "true"
memoFind.Pinned = &pinned
}
tag := c.QueryParam("tag")
if tag != "" {
memoFind.Tag = &tag
}
list, err := s.Store.FindMemoList(memoFind)
if err != nil {

@ -107,6 +107,15 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
if rowStatus != "" {
memoFind.RowStatus = &rowStatus
}
pinnedStr := c.QueryParam("pinned")
if pinnedStr != "" {
pinned := pinnedStr == "true"
memoFind.Pinned = &pinned
}
tag := c.QueryParam("tag")
if tag != "" {
memoFind.Tag = &tag
}
list, err := s.Store.FindMemoList(memoFind)
if err != nil {

@ -209,6 +209,9 @@ func findMemoRawList(db *sql.DB, find *api.MemoFind) ([]*memoRaw, error) {
if v := find.Pinned; v != nil {
where = append(where, "id in (SELECT memo_id FROM memo_organizer WHERE pinned = 1 AND user_id = memo.creator_id )")
}
if v := find.Tag; v != nil {
where, args = append(where, "content LIKE ?"), append(args, "%#"+*v+"%")
}
rows, err := db.Query(`
SELECT

Loading…
Cancel
Save