chore: auto-commit (10 archivos)
- chat.log - db.go - frontend/src/App.tsx - frontend/src/api.ts - frontend/src/components/CardForm.tsx - frontend/src/components/Dashboard.tsx - frontend/src/components/KanbanCard.tsx - frontend/src/types.ts - handlers.go - metrics.go Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+48
-5
@@ -118,11 +118,12 @@ func handleReorderColumns(db *DB) http.HandlerFunc {
|
||||
func handleCreateCard(db *DB) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var body struct {
|
||||
ColumnID string `json:"column_id"`
|
||||
Requester string `json:"requester"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
AssigneeID *string `json:"assignee_id"`
|
||||
ColumnID string `json:"column_id"`
|
||||
Requester string `json:"requester"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
AssigneeID *string `json:"assignee_id"`
|
||||
Tags []string `json:"tags"`
|
||||
}
|
||||
if err := infra.HTTPParseBody(r, &body, maxBodyBytes); err != nil {
|
||||
badRequest(w, err.Error())
|
||||
@@ -140,6 +141,13 @@ func handleCreateCard(db *DB) http.HandlerFunc {
|
||||
c.AssigneeID = body.AssigneeID
|
||||
}
|
||||
}
|
||||
if err == nil && len(body.Tags) > 0 {
|
||||
tags := body.Tags
|
||||
err = db.UpdateCardWithActor(c.ID, CardPatch{Tags: &tags}, actor)
|
||||
if err == nil {
|
||||
c.Tags = tags
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
serverError(w, err)
|
||||
return
|
||||
@@ -182,6 +190,17 @@ func handleUpdateCard(db *DB) http.HandlerFunc {
|
||||
patch.AssigneeID = &s
|
||||
}
|
||||
}
|
||||
if v, present := raw["tags"]; present {
|
||||
tags := []string{}
|
||||
if arr, ok := v.([]any); ok {
|
||||
for _, t := range arr {
|
||||
if s, ok := t.(string); ok {
|
||||
tags = append(tags, s)
|
||||
}
|
||||
}
|
||||
}
|
||||
patch.Tags = &tags
|
||||
}
|
||||
actor, _ := infra.UserIDFromContext(r.Context(), userCtxKey)
|
||||
if err := db.UpdateCardWithActor(id, patch, actor); err != nil {
|
||||
serverError(w, err)
|
||||
@@ -303,5 +322,29 @@ func apiRoutes(db *DB, chatWorkdir string, logger *ChatLogger) []infra.Route {
|
||||
{Method: "DELETE", Path: "/api/cards/{id}/purge", Handler: handlePurgeCard(db)},
|
||||
{Method: "POST", Path: "/api/chat", Handler: handleChat(db, chatWorkdir, logger)},
|
||||
{Method: "GET", Path: "/api/metrics", Handler: handleMetrics(db)},
|
||||
{Method: "GET", Path: "/api/tags", Handler: handleListTags(db)},
|
||||
{Method: "GET", Path: "/api/requesters", Handler: handleListRequesters(db)},
|
||||
}
|
||||
}
|
||||
|
||||
func handleListTags(db *DB) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
tags, err := db.ListAllTags()
|
||||
if err != nil {
|
||||
serverError(w, err)
|
||||
return
|
||||
}
|
||||
infra.HTTPJSONResponse(w, http.StatusOK, tags)
|
||||
}
|
||||
}
|
||||
|
||||
func handleListRequesters(db *DB) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
out, err := db.ListDistinctRequesters()
|
||||
if err != nil {
|
||||
serverError(w, err)
|
||||
return
|
||||
}
|
||||
infra.HTTPJSONResponse(w, http.StatusOK, out)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user