- Add schema for im_conversations and im_messages tables - ConversationModel/MessageModel: WatermelonDB ORM models - ImDatabase: init/saveMessage/getMessages/getConversations/markRead/bulkSave - ImSDK: fetchHistory/fetchGroupHistory read local DB first, cache server results - ImSDK: incoming WebSocket messages auto-saved to local DB - ImSDK: new listConversations() and markRead() public APIs - @nozbe/watermelondb >=0.27.0 added as peer dependency Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
20 行
688 B
TypeScript
20 行
688 B
TypeScript
import { Model } from '@nozbe/watermelondb'
|
|
import { field } from '@nozbe/watermelondb/decorators'
|
|
|
|
export class MessageModel extends Model {
|
|
static table = 'im_messages'
|
|
|
|
@field('server_id') serverId!: string
|
|
@field('app_id') appId!: string
|
|
@field('conversation_id') conversationId!: string
|
|
@field('from_user_id') fromUserId!: string
|
|
@field('to_id') toId!: string
|
|
@field('chat_type') chatType!: string
|
|
@field('msg_type') msgType!: string
|
|
@field('content') content!: string
|
|
@field('status') status!: string
|
|
@field('mentioned_user_ids') mentionedUserIds!: string | null
|
|
@field('server_created_at') serverCreatedAt!: number
|
|
@field('synced_at') syncedAt!: number
|
|
}
|