Skip to content

Commit b46d4c2

Browse files
h4rk8sDiamondYuan
authored andcommitted
Update service.ts
fixed notion new API, must input space_id
1 parent 39344f9 commit b46d4c2

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/common/backend/services/notion/service.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export default class NotionDocumentService implements DocumentService {
132132
if (!this.userContent) {
133133
this.userContent = await this.getUserContent();
134134
}
135+
const spaceId = Object.values(this.userContent.recordMap.space)[0].value.id;
135136
const documentId = generateUuid();
136137
const parentId = repository.id;
137138
const userId = Object.values(this.userContent.recordMap.notion_user)[0].value.id;
@@ -147,6 +148,7 @@ export default class NotionDocumentService implements DocumentService {
147148
args: {
148149
type: 'page',
149150
id: documentId,
151+
space_id: spaceId,
150152
version: 1,
151153
},
152154
},
@@ -159,14 +161,18 @@ export default class NotionDocumentService implements DocumentService {
159161
parent_id: parentId,
160162
parent_table: 'block',
161163
alive: true,
164+
space_id: spaceId,
162165
},
163166
},
164167
{
165168
table: 'block',
166169
id: parentId,
167170
path: ['content'],
168171
command: 'listAfter',
169-
args: { id: documentId },
172+
args: {
173+
id: documentId,
174+
space_id: spaceId,
175+
},
170176
},
171177
{
172178
id: documentId,
@@ -178,14 +184,18 @@ export default class NotionDocumentService implements DocumentService {
178184
created_time: time,
179185
last_edited_time: time,
180186
last_edited_by: userId,
187+
space_id: spaceId,
181188
},
182189
},
183190
{
184191
id: parentId,
185192
table: 'block',
186193
path: [],
187194
command: 'update',
188-
args: { last_edited_time: time },
195+
args: {
196+
last_edited_time: time,
197+
space_id: spaceId,
198+
},
189199
},
190200
{
191201
id: documentId,
@@ -199,7 +209,10 @@ export default class NotionDocumentService implements DocumentService {
199209
table: 'block',
200210
path: [],
201211
command: 'update',
202-
args: { last_edited_time: time },
212+
args: {
213+
last_edited_time: time,
214+
space_id: spaceId,
215+
},
203216
},
204217
];
205218
} else if (repository.pageType === COLLECTION_VIEW_PAGE) {
@@ -212,6 +225,7 @@ export default class NotionDocumentService implements DocumentService {
212225
args: {
213226
type: 'page',
214227
id: documentId,
228+
space_id: spaceId,
215229
version: 1,
216230
},
217231
},
@@ -223,6 +237,7 @@ export default class NotionDocumentService implements DocumentService {
223237
args: {
224238
parent_id: parentId,
225239
parent_table: 'collection',
240+
space_id: spaceId,
226241
alive: true,
227242
},
228243
},

0 commit comments

Comments
 (0)