Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • develop
  • fSearch
  • fuzzySearch
  • fuzzySearchChanges
  • hotFixInFuzzySearch
  • hotFixSeedFunction
  • master
7 results

Target

Select target project
  • roshan.suvarnkar/hdfc-common-utility
1 result
Select Git revision
  • develop
  • fSearch
  • fuzzySearch
  • fuzzySearchChanges
  • hotFixInFuzzySearch
  • hotFixSeedFunction
  • master
7 results
Show changes

Commits on Source 4

......@@ -115,6 +115,10 @@ export function handlePrismaError(error: unknown): never {
throw new AppException(`Prisma validation error: ${error.message}`, 404);
}
if (error instanceof AppException) {
throw error;
}
// Fallback for anything else
throw new AppException('Unexpected database error.', 500);
}
......@@ -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;
......