chore: Various importer improvements (#6519)
* Handle new Notion export format Clear data on file operation delete * fix: Don't restart development server on html upload * fix: Do not send collection created notifications on bulk import * fix: Avoid parellelizing all uploads at once Move import into one transaction per-collection
This commit is contained in:
@@ -1006,22 +1006,25 @@ class Document extends ParanoidModel<
|
||||
toNavigationNode = async (
|
||||
options?: FindOptions<Document>
|
||||
): Promise<NavigationNode> => {
|
||||
const childDocuments = await (this.constructor as typeof Document)
|
||||
.unscoped()
|
||||
.scope("withoutState")
|
||||
.findAll({
|
||||
where: {
|
||||
teamId: this.teamId,
|
||||
parentDocumentId: this.id,
|
||||
archivedAt: {
|
||||
[Op.is]: null,
|
||||
},
|
||||
publishedAt: {
|
||||
[Op.ne]: null,
|
||||
},
|
||||
},
|
||||
transaction: options?.transaction,
|
||||
});
|
||||
// Checking if the record is new is a performance optimization – new docs cannot have children
|
||||
const childDocuments = this.isNewRecord
|
||||
? []
|
||||
: await (this.constructor as typeof Document)
|
||||
.unscoped()
|
||||
.scope("withoutState")
|
||||
.findAll({
|
||||
where: {
|
||||
teamId: this.teamId,
|
||||
parentDocumentId: this.id,
|
||||
archivedAt: {
|
||||
[Op.is]: null,
|
||||
},
|
||||
publishedAt: {
|
||||
[Op.ne]: null,
|
||||
},
|
||||
},
|
||||
transaction: options?.transaction,
|
||||
});
|
||||
|
||||
const children = await Promise.all(
|
||||
childDocuments.map((child) => child.toNavigationNode(options))
|
||||
|
||||
Reference in New Issue
Block a user