feat: QR-Code für alle Kanäle (contact_id in ConversationResponse)

This commit is contained in:
2026-03-17 15:19:40 +01:00
parent 7c237836e8
commit 28d3b36b78
3 changed files with 9 additions and 10 deletions

View File

@@ -20,14 +20,13 @@ def list_conversations(
result = []
for conv in convs:
last_msg = conv.messages[-1] if conv.messages else None
contact_id = conv.participants[0].id if conv.participants else None
result.append(
ConversationResponse(
**{
c.key: getattr(conv, c.key)
for c in conv.__table__.columns
},
**{c.key: getattr(conv, c.key) for c in conv.__table__.columns},
last_message=MessageResponse.model_validate(last_msg) if last_msg else None,
unread_count=conversation_service.unread_count(db, conv.id),
contact_id=contact_id,
)
)
return result
@@ -43,10 +42,12 @@ def get_conversation(
if not conv:
raise HTTPException(status_code=404, detail="Conversation not found")
last_msg = conv.messages[-1] if conv.messages else None
contact_id = conv.participants[0].id if conv.participants else None
return ConversationResponse(
**{c.key: getattr(conv, c.key) for c in conv.__table__.columns},
last_message=MessageResponse.model_validate(last_msg) if last_msg else None,
unread_count=conversation_service.unread_count(db, conv.id),
contact_id=contact_id,
)