mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-24 09:52:49 +08:00
feat(server): improve context error handle (#11342)
This commit is contained in:
@@ -217,6 +217,23 @@ export class ContextSession implements AsyncDisposable {
|
||||
);
|
||||
}
|
||||
|
||||
async saveDocRecord(
|
||||
docId: string,
|
||||
cb: (
|
||||
record: Pick<ContextDoc, 'id' | 'status'> &
|
||||
Partial<Omit<ContextDoc, 'id' | 'status'>>
|
||||
) => ContextDoc
|
||||
) {
|
||||
const docs = [this.config.docs, ...this.config.categories.map(c => c.docs)]
|
||||
.flat()
|
||||
.filter(d => d.id === docId);
|
||||
for (const doc of docs) {
|
||||
Object.assign(doc, cb({ ...doc }));
|
||||
}
|
||||
|
||||
await this.save();
|
||||
}
|
||||
|
||||
async saveFileRecord(
|
||||
fileId: string,
|
||||
cb: (
|
||||
|
||||
Reference in New Issue
Block a user