Add: support walk database with tags

This commit is contained in:
2021-12-13 13:24:25 +08:00
parent d4718ac120
commit a826e4bf29
4 changed files with 144 additions and 66 deletions

View File

@@ -8,6 +8,7 @@ import (
type WalkRequest struct {
Root string `json:"root"`
Pattern []string `json:"pattern"`
TagIDs []int64 `json:"tag_ids"`
}
type ResetRequest struct {
@@ -71,8 +72,15 @@ func (api *API) HandleWalk(w http.ResponseWriter, r *http.Request) {
return
}
// get userID
userID, err := api.GetUserID(w, r)
if err != nil {
api.HandleError(w, r, err)
return
}
// walk
err = api.Db.Walk(walkRequest.Root, walkRequest.Pattern)
err = api.Db.Walk(walkRequest.Root, walkRequest.Pattern, walkRequest.TagIDs, userID)
if err != nil {
api.HandleError(w, r, err)
return