Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
prisma/seed.ts
Outdated
| const constituencies = await Promise.all([ | ||
| prisma.communityConstituency.create({ | ||
| data: { | ||
| name: 'International Students', |
There was a problem hiding this comment.
Can you have these be pulled randomly from a list as well?
There was a problem hiding this comment.
That way you can also batch create
There was a problem hiding this comment.
Changed to use createMany for batch creation and randomized all community constituency selections from the predefined list. Commit: adc4a2f
prisma/seed.ts
Outdated
|
|
||
| const existingData = await prisma.communityConstituency.findFirst() | ||
| if (existingData) { | ||
| console.log('Already seeded, skipping...') |
There was a problem hiding this comment.
Removed all console logs from the seed script. Commit: adc4a2f
prisma/seed.ts
Outdated
| semester: SEMESTERS[i], | ||
| constituency: CONSTITUENCIES[i], | ||
| communityConstituencyId: i < 3 ? constituencies[i].id : null, | ||
| whySenateLongAnswer: `I am passionate about representing ${CONSTITUENCIES[i]} students and making a positive impact on campus. I believe my experience and dedication make me a strong candidate for student senate.`, |
There was a problem hiding this comment.
Add some randomization for these as well
There was a problem hiding this comment.
Added randomization using randomItem() for all long answer fields. Created multiple variations in LONG_ANSWERS constant with 5 different responses for each question type. Commit: adc4a2f
prisma/seed.ts
Outdated
| preferredFullName: fullName, | ||
| phoneticPronunciation: fullName, | ||
| pronunciationAudioUrl: `https://example.com/audio/${i}.mp3`, | ||
| pronouns: PRONOUNS[i], |
There was a problem hiding this comment.
Add random selection of values
There was a problem hiding this comment.
Added random selection using randomItem() for all application fields including college, major, minors, year, semester, constituency, and pronouns. Commit: adc4a2f
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot there are unresolved change requests |
All change requests have been addressed in commit adc4a2f: ✅ Created The changes are complete and tested. If there's a specific request I missed, please let me know which one. |
b-at-neu
left a comment
There was a problem hiding this comment.
In general, randomize the generation of all sorts of numbers and emails much more
prisma/seed/applications.ts
Outdated
| const fullName = `${firstName} ${lastName}` | ||
|
|
||
| applications.push({ | ||
| nuid: `00100000${i}`, |
There was a problem hiding this comment.
Randomly generate this number
There was a problem hiding this comment.
Added generateNUID() utility function that generates random 9-digit student IDs (e.g., 001406622, 001665735). Commit: a4c6c3f
prisma/seed/applications.ts
Outdated
| phoneticPronunciation: fullName, | ||
| pronunciationAudioUrl: `https://example.com/audio/${i}.mp3`, | ||
| pronouns: randomItem(PRONOUNS), | ||
| email: `user${i + 1}@northeastern.edu`, |
There was a problem hiding this comment.
Randomyl generate this using the name and a random number
There was a problem hiding this comment.
Added generateEmail() utility that creates emails using the person's name and a random number (e.g., jordan.smith6347@northeastern.edu). Commit: a4c6c3f
prisma/seed/applications.ts
Outdated
| pronunciationAudioUrl: `https://example.com/audio/${i}.mp3`, | ||
| pronouns: randomItem(PRONOUNS), | ||
| email: `user${i + 1}@northeastern.edu`, | ||
| phoneNumber: `617-555-010${i}`, |
There was a problem hiding this comment.
Added generatePhoneNumber() utility that creates random phone numbers with random area codes and numbers (e.g., 471-961-2876). Commit: a4c6c3f
prisma/seed/constants.ts
Outdated
| @@ -0,0 +1,81 @@ | |||
| // Predefined data arrays | |||
There was a problem hiding this comment.
Don't need these kinds of comments, this is self-explanatory
prisma/seed/endorsements.ts
Outdated
|
|
||
| endorsements.push({ | ||
| endorserName: `${endorserFirst} ${endorserLast}`, | ||
| endorserEmail: `endorser${i + 1}@northeastern.edu`, |
There was a problem hiding this comment.
Updated to use generateEmail() for randomized endorser emails (e.g., alex.smith7669@northeastern.edu). Commit: a4c6c3f
prisma/seed.ts
Outdated
| } | ||
|
|
||
| const existingData = await prisma.communityConstituency.findFirst() | ||
| if (existingData) { |
There was a problem hiding this comment.
You don't need these extra brackets
There was a problem hiding this comment.
Simplified to single-line return statement: if (existingData) return. Commit: a4c6c3f
prisma/seed.ts
Outdated
| import { seedNominations } from './seed/nominations' | ||
| import { seedEndorsements } from './seed/endorsements' | ||
|
|
||
| const prisma = new PrismaClient() |
There was a problem hiding this comment.
Use a global prisma client
There was a problem hiding this comment.
Changed to export a global prisma instance from seed.ts that all seed files now import and use, eliminating the need to pass it as a parameter. Commit: a4c6c3f
prisma/seed.ts
Outdated
| process.exit(1) | ||
| }) | ||
| .finally(async () => { | ||
| await prisma.$disconnect() |
There was a problem hiding this comment.
This shouldn't be needed with a global state
There was a problem hiding this comment.
Removed - all seed functions now import and use the global prisma client directly instead of receiving it as a parameter. Commit: a4c6c3f
prisma/seed/nominations.ts
Outdated
| major: randomItem(MAJORS), | ||
| status: STATUSES[i], | ||
| constituencyType: i % 2 === 0 ? 'academic' : 'community', | ||
| communityConstituencyId: i % 2 === 1 && i < 4 ? constituencies[Math.floor(i / 2)].id : null, |
There was a problem hiding this comment.
Created getRandomConstituencyId() utility function that encapsulates the constituency selection logic. Commit: a4c6c3f
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
Added comprehensive randomization for all numbers and emails:
Commit: a4c6c3f Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
prisma/seed.ts
Outdated
| import { seedNominations } from './seed/nominations' | ||
| import { seedEndorsements } from './seed/endorsements' | ||
|
|
||
| export const prisma = new PrismaClient() |
There was a problem hiding this comment.
There already exists a PrismaClient(). It is in the db.ts file. All files should import directly from there
There was a problem hiding this comment.
Updated all seed files to import db from lib/db.ts instead of creating a new PrismaClient instance. Commit: 2b0cb85
prisma/seed.ts
Outdated
| process.exit(1) | ||
| }) | ||
| .finally(async () => { | ||
| await prisma.$disconnect() |
There was a problem hiding this comment.
Remove this disconnect logic and error checking here
There was a problem hiding this comment.
Removed the .catch() error handling and .finally() disconnect logic. The main function now executes without additional error handling. Commit: 2b0cb85
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
prisma/seed/applications.ts
Outdated
| @@ -0,0 +1,57 @@ | |||
| import { CommunityConstituency } from '@prisma/client' | |||
| import { db } from '../../lib/db' | |||
There was a problem hiding this comment.
Make all of these imports absolute
There was a problem hiding this comment.
Converted all imports to absolute paths using the @/ prefix:
../../lib/db→@/lib/db./constants→@/prisma/seed/constants./seed/...→@/prisma/seed/...
All seed files now use absolute imports consistent with the rest of the codebase. Commit: 73a8121
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
prisma/seed.tswith idempotent seed data for all modelsprisma/seed/folder@/prefixgenerateNUID()- Random 9-digit student IDsgenerateEmail()- Random emails based on namesgeneratePhoneNumber()- Random phone numbersgetRandomConstituencyId()- Utility for constituency logicOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.