feat(phase3): forum channels + tags + card UI

This commit is contained in:
2026-06-30 10:44:52 -04:00
parent f3f03df710
commit 368172e3d6
12 changed files with 407 additions and 87 deletions
+13 -2
View File
@@ -11,8 +11,9 @@ import (
)
type createThreadRequest struct {
Name string `json:"name"`
MessageID *string `json:"message_id,omitempty"`
Name string `json:"name"`
MessageID *string `json:"message_id,omitempty"`
TagIDs []string `json:"tag_ids,omitempty"`
}
type threadResponse struct {
@@ -95,6 +96,16 @@ func (h *Handler) CreateThread(w http.ResponseWriter, r *http.Request) {
return
}
// Attach optional tags for forum posts.
if len(req.TagIDs) > 0 {
// ponytail: ignore tag errors; best-effort assignment
for _, tagID := range req.TagIDs {
_, _ = h.db.ExecContext(r.Context(), `
INSERT INTO channel_tags (channel_id, tag_id) VALUES ($1, $2) ON CONFLICT DO NOTHING
`, thread.ID, tagID)
}
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusCreated)
json.NewEncoder(w).Encode(thread)