mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-25 07:56:13 +00:00
fix insert webhook all fields
This commit is contained in:
@@ -9,6 +9,8 @@ import { AttachmentUrlUploadPreparator } from './attachment-url-upload-preparato
|
|||||||
import type { Column } from 'src/models';
|
import type { Column } from 'src/models';
|
||||||
import type { IBaseModelSqlV2 } from '../IBaseModelSqlV2';
|
import type { IBaseModelSqlV2 } from '../IBaseModelSqlV2';
|
||||||
import { handleUniqueConstraintError } from '~/helpers/uniqueConstraintErrorHandler';
|
import { handleUniqueConstraintError } from '~/helpers/uniqueConstraintErrorHandler';
|
||||||
|
import getAst from '~/helpers/getAst';
|
||||||
|
import { nocoExecute } from '~/utils';
|
||||||
|
|
||||||
export const baseModelInsert = (baseModel: IBaseModelSqlV2) => {
|
export const baseModelInsert = (baseModel: IBaseModelSqlV2) => {
|
||||||
const single = async (
|
const single = async (
|
||||||
@@ -397,13 +399,25 @@ export const baseModelInsert = (baseModel: IBaseModelSqlV2) => {
|
|||||||
req: cookie,
|
req: cookie,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
const insertResponseList = await baseModel.chunkList({
|
||||||
|
pks: responses.map((d) => baseModel.extractPksValues(d)),
|
||||||
|
});
|
||||||
|
|
||||||
|
// get ast
|
||||||
|
const { ast, parsedQuery } = await getAst(baseModel.context, {
|
||||||
|
model: baseModel.model,
|
||||||
|
query: {},
|
||||||
|
extractOnlyPrimaries: false,
|
||||||
|
});
|
||||||
|
// nocoexecute
|
||||||
|
const insertResponses = await nocoExecute(
|
||||||
|
ast,
|
||||||
|
insertResponseList,
|
||||||
|
{},
|
||||||
|
parsedQuery,
|
||||||
|
);
|
||||||
await baseModel.afterBulkInsert(
|
await baseModel.afterBulkInsert(
|
||||||
insertDatas.map((data, index) => {
|
insertResponses,
|
||||||
return {
|
|
||||||
...responses[index],
|
|
||||||
...data,
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
baseModel.dbDriver,
|
baseModel.dbDriver,
|
||||||
cookie,
|
cookie,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user