fix: WhatsApp @c.us Doppel-Suffix + Chat löschen in TUI
- WhatsApp send: @c.us wird vor dem Anhängen entfernt (verhindert 4915..@c.us@c.us) - DELETE /api/v1/conversations/{id}: löscht Konversation + alle Nachrichten - TUI: Taste D öffnet Bestätigungsdialog zum Löschen des aktuellen Chats
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, status
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from api.auth import require_api_key
|
||||
@@ -64,3 +64,15 @@ def get_messages(
|
||||
msgs = conversation_service.get_messages(db, conv_id, limit=limit, offset=offset)
|
||||
conversation_service.mark_all_read(db, conv_id)
|
||||
return [MessageResponse.model_validate(m) for m in msgs]
|
||||
|
||||
|
||||
@router.delete("/{conv_id}", status_code=status.HTTP_204_NO_CONTENT)
|
||||
def delete_conversation(
|
||||
conv_id: str,
|
||||
db: Session = Depends(get_db),
|
||||
_: str = Depends(require_api_key),
|
||||
):
|
||||
conv = conversation_service.get_by_id(db, conv_id)
|
||||
if not conv:
|
||||
raise HTTPException(status_code=404, detail="Conversation not found")
|
||||
conversation_service.delete(db, conv)
|
||||
|
||||
Reference in New Issue
Block a user