Dev #8

Merged
sandrodach merged 30 commits from dev into main 2026-10-27 22:02:54 +01:00
2 changed files with 16 additions and 0 deletions
Showing only changes of commit fd95c2f8da - Show all commits

No files matched your search

+4
View File
@@ -309,6 +309,10 @@ export const api = {
return ensureArray(res);
},
async getThought(thoughtId: string): Promise<Thought> {
return request<Thought>(`/api/v1/thoughts/${encodeURIComponent(thoughtId)}`);
},
async triageAction(
thoughtId: string,
action: 'keep' | 'discard' | 'restore',
+12
View File
@@ -88,6 +88,7 @@ func (s *Server) Router() http.Handler {
// Instant Capture & Thoughts
r.Post("/api/v1/inbox", s.handleCaptureInbox)
r.Get("/api/v1/thoughts", s.handleGetThoughts)
r.Get("/api/v1/thoughts/{id}", s.handleGetThought)
r.Patch("/api/v1/thoughts/{id}", s.handleUpdateThought)
r.Delete("/api/v1/thoughts/{id}", s.handleDeleteThought)
r.Delete("/api/v1/thoughts/discarded/purge", s.handlePurgeDiscarded)
@@ -702,6 +703,17 @@ func (s *Server) handleGetThoughts(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, thoughts)
}
func (s *Server) handleGetThought(w http.ResponseWriter, r *http.Request) {
userID := auth.GetUserID(r.Context())
thoughtID := chi.URLParam(r, "id")
thought, err := s.store.GetThoughtByID(userID, thoughtID)
if err != nil || thought == nil {
writeError(w, http.StatusNotFound, "Aufgabe nicht gefunden")
return
}
writeJSON(w, http.StatusOK, thought)
}
func (s *Server) handleGetTriageDeck(w http.ResponseWriter, r *http.Request) {
userID := auth.GetUserID(r.Context())
thoughts, err := s.store.GetThoughts(userID, "inbox", 100)