From a4947516ba96434096be40e4a485b262fe160dd8 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 13 Feb 2026 11:21:54 -0500 Subject: [PATCH] Add /seen endpoint - mark messages triaged without archiving --- main.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/main.go b/main.go index aa58329..d5fb39c 100644 --- a/main.go +++ b/main.go @@ -437,6 +437,8 @@ func handleMessageRoutes(w http.ResponseWriter, r *http.Request) { handleToDocs(w, r, messageID) case "attachments": handleAttachments(w, r, messageID) + case "seen": + handleSeen(w, r, messageID) default: http.Error(w, "Unknown action", http.StatusNotFound) } @@ -474,6 +476,19 @@ func handleArchive(w http.ResponseWriter, r *http.Request, id string) { json.NewEncoder(w).Encode(map[string]string{"status": "archived"}) } +// POST /messages/{id}/seen - mark as seen without archiving/deleting +// Removes from /messages/new but keeps message in its original mailbox +func handleSeen(w http.ResponseWriter, r *http.Request, id string) { + if r.Method != "POST" { + http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) + return + } + + orch.RecordAction(id, "seen") + + json.NewEncoder(w).Encode(map[string]string{"status": "seen"}) +} + func handleDelete(w http.ResponseWriter, r *http.Request, id string) { if r.Method != "POST" { http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)