mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 10:06:17 +08:00
feat(server): handle workspace doc updates (#11937)
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user