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[] = [];
|
const validated: any[] = [];
|
||||||
for (const row of data) {
|
for (const row of data) {
|
||||||
const validatedData = {
|
let validatedData = {
|
||||||
...entity.getDefaultObject(),
|
...entity.getDefaultObject(),
|
||||||
...(await this.getValidatedData(row, "create")),
|
...(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);
|
validated.push(validatedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user