Add /seen endpoint - mark messages triaged without archiving
This commit is contained in:
parent
5084e879ef
commit
a4947516ba
15
main.go
15
main.go
|
|
@ -437,6 +437,8 @@ func handleMessageRoutes(w http.ResponseWriter, r *http.Request) {
|
||||||
handleToDocs(w, r, messageID)
|
handleToDocs(w, r, messageID)
|
||||||
case "attachments":
|
case "attachments":
|
||||||
handleAttachments(w, r, messageID)
|
handleAttachments(w, r, messageID)
|
||||||
|
case "seen":
|
||||||
|
handleSeen(w, r, messageID)
|
||||||
default:
|
default:
|
||||||
http.Error(w, "Unknown action", http.StatusNotFound)
|
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"})
|
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) {
|
func handleDelete(w http.ResponseWriter, r *http.Request, id string) {
|
||||||
if r.Method != "POST" {
|
if r.Method != "POST" {
|
||||||
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue