Skip to content
Snippets Groups Projects
Commit 01d8d141 authored by Roshan Suvarnkar's avatar Roshan Suvarnkar
Browse files

Merge branch 'hotFixSeedFunction' into 'develop'

did changes in multiple seed function

See merge request !6
parents 8f7de0be 70ab510c
Branches
No related tags found
1 merge request!6did changes in multiple seed function
......@@ -116,6 +116,7 @@ export const seedWithRelation = async <
export type ForeignKeyConfig<ChildType> = {
parentModel: keyof PrismaClient;
parentLookupKey: string;
parentPrimaryKey?: string;
childReferenceKey: keyof ChildType;
childForeignKeyField: keyof ChildType;
};
......@@ -141,7 +142,8 @@ export const seedWithMultipleParents = async <
const map = new Map<any, any>();
for (const parent of parents) {
map.set(parent[fk.parentLookupKey], parent.id);
const id = fk.parentPrimaryKey ?? "id";
map.set(parent[fk.parentLookupKey], parent[id]);
}
lookupMaps[String(fk.parentModel)] = map;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment