forked from mtusi2026/mtusi2026lab5
27 lines
557 B
TypeScript
27 lines
557 B
TypeScript
import { Message } from '../../common/domain';
|
|
|
|
export interface MessageResponse {
|
|
id: string;
|
|
chat_id: string;
|
|
sender_id: string;
|
|
text: string;
|
|
created_at: string;
|
|
attachment_ids: string[];
|
|
}
|
|
|
|
export interface MessagePageResponse {
|
|
items: MessageResponse[];
|
|
next_cursor: string | null;
|
|
}
|
|
|
|
export function toMessageResponse(message: Message): MessageResponse {
|
|
return {
|
|
id: message.id,
|
|
chat_id: message.chatId,
|
|
sender_id: message.senderId,
|
|
text: message.text,
|
|
created_at: message.createdAt,
|
|
attachment_ids: message.attachmentIds,
|
|
};
|
|
}
|