Add /seen endpoint - mark messages triaged without archiving

This commit is contained in:
James 2026-02-13 11:21:54 -05:00
parent 5084e879ef
commit a4947516ba
1 changed files with 15 additions and 0 deletions

15
main.go
View File

@ -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)