From abcf2cc5b2496f580afb3c18666f7a68a9f90f21 Mon Sep 17 00:00:00 2001 From: Stuart Long Chay Boon Date: Mon, 24 Oct 2022 21:25:25 +0800 Subject: [PATCH] [offers][fix] integrate random name generator to profile seeding --- apps/portal/prisma/readSheet.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/portal/prisma/readSheet.ts b/apps/portal/prisma/readSheet.ts index 067c3d3f..5b286816 100644 --- a/apps/portal/prisma/readSheet.ts +++ b/apps/portal/prisma/readSheet.ts @@ -4,6 +4,7 @@ import crypto from 'crypto'; import { baseCurrencyString } from '../src/utils/offers/currency'; import { convert } from '../src/utils/offers/currency/currencyExchange'; import { generateAnalysis } from '../src/utils/offers/analysisGeneration'; +import generateRandomName from '../src/utils/offers/randomNameGenerator'; const prisma = new PrismaClient(); @@ -68,11 +69,15 @@ const seedSalaries = async () => { .createHash('sha256') .update(xlSerialToJsDate(data.Timestamp).toString()) .digest('hex'); + + // Generate random name until unique + let uniqueName: string = await generateRandomName(); + if (data.Type.toUpperCase() === 'INTERNSHIP') { // create profile const dataAdded = await prisma.offersProfile.create({ data: { - profileName: crypto.randomUUID().substring(0, 10), + profileName: uniqueName, createdAt: xlSerialToJsDate(data.Timestamp), editToken: token, background: {