func DeleteIncoming(w http.ResponseWriter, req *http.Request) {
	// Check ticket
	t, err := fetchTicketHeader(req)
	if err != nil {
		httputils.ErrorOut(w, http.StatusUnauthorized, invalidTicketID)
		return
	}

	if !message.IncomingPathExists(t.ID, "") {
		httputils.ErrorOut(w, http.StatusNotFound, "message not found")
		return
	}

	err = message.RemoveMessage(message.SectionIncoming, t.ID)
	if err != nil {
		httputils.ErrorOut(w, http.StatusInternalServerError, "error while deleting outgoing message")
		return
	}

	// Remove ticket
	ticketRepo := container.Instance.GetTicketRepo()
	ticketRepo.Remove(t.ID)

	_ = httputils.JSONOut(w, http.StatusOK, httputils.StatusOk("message removed"))
}
// DeleteIncoming is called whenever we want to completely remove a message by user request
DeleteIncoming is called whenever we want to completely remove a message by user request
// DeleteIncoming is called whenever we want to completely remove a message by user request
func DeleteIncoming(w http.ResponseWriter, req *http.Request) {
	t, err := fetchTicketHeader(req)
	if err != nil {
		httputils.ErrorOut(w, http.StatusUnauthorized, invalidTicketID)
		return
	}
	if !message.IncomingPathExists(t.ID, "") {
		httputils.ErrorOut(w, http.StatusNotFound, "message not found")
		return
	}
	err = message.RemoveMessage(message.SectionIncoming, t.ID)
	if err != nil {
		httputils.ErrorOut(w, http.StatusInternalServerError, "error while deleting outgoing message")
		return
	}
	ticketRepo := container.Instance.GetTicketRepo()
	ticketRepo.Remove(t.ID)
	_ = httputils.JSONOut(w, http.StatusOK, httputils.StatusOk("message removed"))
}
func DeleteIncoming ( w http . ResponseWriter , req * http . Request ) { t , err := fetchTicketHeader ( req ) if err != nil { httputils . ErrorOut ( w , http . StatusUnauthorized , invalidTicketID ) return } if ! message . IncomingPathExists ( t . ID , " " ) { httputils . ErrorOut ( w , http . StatusNotFound , " " ) return } err = message . RemoveMessage ( message . SectionIncoming , t . ID ) if err != nil { httputils . ErrorOut ( w , http . StatusInternalServerError , " " ) return } ticketRepo := container . Instance . GetTicketRepo ( ) ticketRepo . Remove ( t . ID ) _ = httputils . JSONOut ( w , http . StatusOK , httputils . StatusOk ( " " ) ) }
DeleteIncoming is called whenever we want to completely remove a message by user request
DeleteIncoming is called whenever we want to completely remove a message by user request
// Check ticket // Remove ticket