From 416636530a4f7e2e971a55e7c75f635e6c6323e4 Mon Sep 17 00:00:00 2001 From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com> Date: Thu, 2 Apr 2026 17:45:23 +0200 Subject: [PATCH] feat(shared): add DmLastMessagePreview type with attachment metadata Introduces a lightweight DmLastMessagePreview interface for the ready payload and GET /api/dm response, and widens DmChannel.lastMessage to accept either DmLastMessagePreview or DmMessageWithUser so both the static preview path and real-time WS events can coexist without casts. --- packages/shared/src/types.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/shared/src/types.ts b/packages/shared/src/types.ts index bcadb12b..ceebe390 100644 --- a/packages/shared/src/types.ts +++ b/packages/shared/src/types.ts @@ -287,12 +287,21 @@ export interface ActiveCallInfo { // ─── DM Types ─────────────────────────────────────────────────────────────── +export interface DmLastMessagePreview { + id: string; + dmChannelId: string; + userId: string; + content: string | null; + createdAt: number; + attachments?: Array<{ type: string; filename: string }>; +} + export interface DmChannel { id: string; ownerId?: string | null; createdAt: number; members: User[]; - lastMessage?: DmMessage | null; + lastMessage?: DmLastMessagePreview | DmMessageWithUser | null; } export interface DmMessage {