mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 21:49:25 +08:00
fix(action-import): import with createdBy & updatedBy field (#4939)
This commit is contained in:
parent
027d54dc87
commit
80570c663f
@ -51,7 +51,9 @@ async function importXlsxAction(ctx: Context, next: Next) {
|
|||||||
explain: (ctx.request.body as any).explain,
|
explain: (ctx.request.body as any).explain,
|
||||||
});
|
});
|
||||||
|
|
||||||
const importedCount = await importer.run();
|
const importedCount = await importer.run({
|
||||||
|
context: ctx,
|
||||||
|
});
|
||||||
|
|
||||||
ctx.bodyMeta = { successCount: importedCount };
|
ctx.bodyMeta = { successCount: importedCount };
|
||||||
ctx.body = ctx.bodyMeta;
|
ctx.body = ctx.bodyMeta;
|
||||||
|
@ -30,6 +30,7 @@ type ImporterOptions = {
|
|||||||
|
|
||||||
type RunOptions = {
|
type RunOptions = {
|
||||||
transaction?: Transaction;
|
transaction?: Transaction;
|
||||||
|
context?: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class XlsxImporter extends EventEmitter {
|
export class XlsxImporter extends EventEmitter {
|
||||||
@ -180,6 +181,7 @@ export class XlsxImporter extends EventEmitter {
|
|||||||
|
|
||||||
await this.options.collection.repository.create({
|
await this.options.collection.repository.create({
|
||||||
values: rowValues,
|
values: rowValues,
|
||||||
|
context: options?.context,
|
||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user