feat(web-task): persist local drafts and save shortcut

This commit is contained in:
2026-04-05 23:59:03 +08:00
parent 8ef7c75948
commit 73e0f1312c
3 changed files with 189 additions and 24 deletions
@@ -0,0 +1,32 @@
import { localDb, type LocalTaskDraftRecord } from "@/services/local-db";
export type SaveLocalTaskDraftInput = {
taskId: string;
userId: string;
title: string;
contentJson: string | null;
contentText: string;
priority: LocalTaskDraftRecord["priority"];
status: LocalTaskDraftRecord["status"];
ddlInput: string;
};
export async function getLocalTaskDraft(taskId: string): Promise<LocalTaskDraftRecord | undefined> {
return localDb.taskDrafts.get(taskId);
}
export async function saveLocalTaskDraft(
input: SaveLocalTaskDraftInput
): Promise<LocalTaskDraftRecord> {
const draft: LocalTaskDraftRecord = {
...input,
updatedAt: Date.now()
};
await localDb.taskDrafts.put(draft);
return draft;
}
export async function deleteLocalTaskDraft(taskId: string): Promise<void> {
await localDb.taskDrafts.delete(taskId);
}