fix: add missing primary key generation for insertMany in Mutator.ts
This commit is contained in:
@@ -312,7 +312,7 @@ export class Mutator<
|
||||
|
||||
const validated: any[] = [];
|
||||
for (const row of data) {
|
||||
const validatedData = {
|
||||
let validatedData = {
|
||||
...entity.getDefaultObject(),
|
||||
...(await this.getValidatedData(row, "create")),
|
||||
};
|
||||
@@ -328,6 +328,16 @@ export class Mutator<
|
||||
}
|
||||
}
|
||||
|
||||
// primary
|
||||
const primary = entity.getPrimaryField();
|
||||
const primary_value = primary.getNewValue();
|
||||
if (primary_value) {
|
||||
validatedData = {
|
||||
[primary.name]: primary_value,
|
||||
...validatedData,
|
||||
};
|
||||
}
|
||||
|
||||
validated.push(validatedData);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user