|
|
|
@ -7,7 +7,7 @@ import { elapsedTime, initTime } from '../../helpers';
|
|
|
|
|
import type { BaseModelSqlv2 } from '~/db/BaseModelSqlv2'; |
|
|
|
|
import type { NcContext } from '~/interface/config'; |
|
|
|
|
import type { LinkToAnotherRecordColumn } from '~/models'; |
|
|
|
|
import { Base, Filter, Hook, Model, Source, View } from '~/models'; |
|
|
|
|
import { Base, Comment, Filter, Hook, Model, Source, View } from '~/models'; |
|
|
|
|
import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2'; |
|
|
|
|
import { |
|
|
|
|
getViewAndModelByAliasOrId, |
|
|
|
@ -36,6 +36,7 @@ export class ExportService {
|
|
|
|
|
excludeViews?: boolean; |
|
|
|
|
excludeHooks?: boolean; |
|
|
|
|
excludeData?: boolean; |
|
|
|
|
excludeComments?: boolean; |
|
|
|
|
}, |
|
|
|
|
) { |
|
|
|
|
const { modelIds } = param; |
|
|
|
@ -43,6 +44,8 @@ export class ExportService {
|
|
|
|
|
const excludeData = param?.excludeData || false; |
|
|
|
|
const excludeViews = param?.excludeViews || false; |
|
|
|
|
const excludeHooks = param?.excludeHooks || false; |
|
|
|
|
const excludeComments = |
|
|
|
|
param?.excludeComments || param?.excludeData || false; |
|
|
|
|
|
|
|
|
|
const serializedModels = []; |
|
|
|
|
|
|
|
|
@ -377,6 +380,30 @@ export class ExportService {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const searializedComments = []; |
|
|
|
|
|
|
|
|
|
if (!excludeComments) { |
|
|
|
|
const comments = await Comment.listByModel(context, model.id); |
|
|
|
|
|
|
|
|
|
for (const comment of comments) { |
|
|
|
|
idMap.set(comment.id, `${idMap.get(model.id)}::${comment.id}`); |
|
|
|
|
|
|
|
|
|
searializedComments.push({ |
|
|
|
|
id: idMap.get(comment.id), |
|
|
|
|
fk_model_id: idMap.get(comment.fk_model_id), |
|
|
|
|
row_id: comment.row_id, |
|
|
|
|
comment: comment.comment, |
|
|
|
|
parent_comment_id: comment.parent_comment_id |
|
|
|
|
? idMap.get(comment.parent_comment_id) |
|
|
|
|
: null, |
|
|
|
|
created_by: comment.created_by, |
|
|
|
|
resolved_by: comment.resolved_by, |
|
|
|
|
created_by_email: comment.created_by_email, |
|
|
|
|
resolved_by_email: comment.resolved_by_email, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
serializedModels.push({ |
|
|
|
|
model: { |
|
|
|
|
id: idMap.get(model.id), |
|
|
|
@ -443,6 +470,7 @@ export class ExportService {
|
|
|
|
|
view: view.view, |
|
|
|
|
})), |
|
|
|
|
hooks: serializedHooks, |
|
|
|
|
comments: searializedComments, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|