refactor(data): replace schema classes with readonly models

This commit is contained in:
2026-07-17 13:21:40 +08:00
parent 3437312167
commit ae97366a4a
103 changed files with 1220 additions and 2117 deletions
+11 -9
View File
@@ -1,3 +1,10 @@
import type {
CacheRemoteChatMediaInput,
ChatMediaLookupInput,
IChatRepository,
UnlockPrivateMessageInput,
UnlockedPrivateMessageLocalPatch,
} from "@/data/repositories/interfaces";
import type {
ChatHistoryResponse,
ChatMessage,
@@ -11,13 +18,6 @@ import {
LocalChatStorage,
type LocalChatMediaRow,
} from "@/data/storage/chat";
import type {
CacheRemoteChatMediaInput,
ChatMediaLookupInput,
IChatRepository,
UnlockPrivateMessageInput,
UnlockedPrivateMessageLocalPatch,
} from "@/data/repositories/interfaces";
import type { Result } from "@/utils/result";
import { ChatLocalMessageStore } from "./chat_local_message_store";
@@ -60,7 +60,9 @@ export class ChatRepository implements IChatRepository {
}
/** 一键解锁历史锁定消息。 */
async unlockHistory(characterId: string): Promise<Result<UnlockHistoryResponse>> {
async unlockHistory(
characterId: string,
): Promise<Result<UnlockHistoryResponse>> {
return this.remote.unlockHistory(characterId);
}
@@ -101,7 +103,7 @@ export class ChatRepository implements IChatRepository {
/** 读取所有本地消息,按 dbId 升序。 */
async getLocalMessages(
cacheIdentity?: string,
): Promise<Result<ChatMessage[]>> {
): Promise<Result<readonly ChatMessage[]>> {
return this.localMessages.getMessages(cacheIdentity);
}