feat(server): handle workspace doc updates (#11937)

This commit is contained in:
fengmk2
2025-05-14 14:52:41 +00:00
parent 6792c3e656
commit afa984da54
33 changed files with 1940 additions and 34 deletions
+12 -8
View File
@@ -158,14 +158,7 @@ export class DocModel extends BaseModel {
* Get a doc by workspaceId and docId.
*/
async get(workspaceId: string, docId: string): Promise<Doc | null> {
const row = await this.db.snapshot.findUnique({
where: {
workspaceId_id: {
workspaceId,
id: docId,
},
},
});
const row = await this.getSnapshot(workspaceId, docId);
if (!row) {
return null;
}
@@ -178,6 +171,17 @@ export class DocModel extends BaseModel {
};
}
async getSnapshot(workspaceId: string, docId: string) {
return await this.db.snapshot.findUnique({
where: {
workspaceId_id: {
workspaceId,
id: docId,
},
},
});
}
async getAuthors(workspaceId: string, docId: string) {
return await this.db.snapshot.findUnique({
where: {