fix(api): add getThought endpoint and frontend api method to resolve docker tsc build error
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m0s
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m0s
This commit is contained in:
1 parent
94acb2638e
commit
fd95c2f8da
2 files changed
+16
No files matched your search
@@ -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',
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user