Remove dynamic form builder and complete RoundProject→roundId migration

Major cleanup and schema migration:
- Remove unused dynamic form builder system (ApplicationForm, ApplicationFormField, etc.)
- Complete migration from RoundProject junction table to direct Project.roundId
- Add sortOrder and entryNotificationType fields to Round model
- Add country field to User model for mentor matching
- Enhance onboarding with profile photo and country selection steps
- Fix all TypeScript errors related to roundProjects references
- Remove unused libraries (@radix-ui/react-toast, embla-carousel-react, vaul)

Files removed:
- admin/forms/* pages and related components
- admin/onboarding/* pages
- applicationForm.ts and onboarding.ts routers
- Dynamic form builder Prisma models and enums

Schema changes:
- Removed ApplicationForm, ApplicationFormField, OnboardingStep, ApplicationFormSubmission, SubmissionFile models
- Removed FormFieldType and SpecialFieldType enums
- Added Round.sortOrder, Round.entryNotificationType
- Added User.country

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-04 14:15:06 +01:00
parent 7bcd2ce6ca
commit 29827268b2
71 changed files with 2139 additions and 6609 deletions

View File

@@ -62,7 +62,7 @@ export const applicantRouter = router({
const project = await ctx.prisma.project.findFirst({
where: {
roundProjects: { some: { roundId: input.roundId } },
roundId: input.roundId,
OR: [
{ submittedByUserId: ctx.user.id },
{
@@ -74,14 +74,9 @@ export const applicantRouter = router({
},
include: {
files: true,
roundProjects: {
where: { roundId: input.roundId },
round: {
include: {
round: {
include: {
program: { select: { name: true, year: true } },
},
},
program: { select: { name: true, year: true } },
},
},
teamMembers: {
@@ -179,10 +174,10 @@ export const applicantRouter = router({
},
})
// Update RoundProject status if submitting
// Update Project status if submitting
if (submit) {
await ctx.prisma.roundProject.updateMany({
where: { projectId: projectId },
await ctx.prisma.project.update({
where: { id: projectId },
data: { status: 'SUBMITTED' },
})
}
@@ -198,21 +193,13 @@ export const applicantRouter = router({
// Create new project
const project = await ctx.prisma.project.create({
data: {
programId: roundForCreate.programId,
roundId,
...data,
metadataJson: metadataJson as unknown ?? undefined,
submittedByUserId: ctx.user.id,
submittedByEmail: ctx.user.email,
submissionSource: 'MANUAL',
submittedAt: submit ? now : null,
},
})
// Create RoundProject entry
await ctx.prisma.roundProject.create({
data: {
roundId,
projectId: project.id,
status: 'SUBMITTED',
},
})
@@ -412,15 +399,10 @@ export const applicantRouter = router({
],
},
include: {
roundProjects: {
round: {
include: {
round: {
include: {
program: { select: { name: true, year: true } },
},
},
program: { select: { name: true, year: true } },
},
orderBy: { addedAt: 'desc' },
},
files: true,
teamMembers: {
@@ -440,9 +422,8 @@ export const applicantRouter = router({
})
}
// Get the latest round project status
const latestRoundProject = project.roundProjects[0]
const currentStatus = latestRoundProject?.status ?? 'SUBMITTED'
// Get the project status
const currentStatus = project.status ?? 'SUBMITTED'
// Build timeline
const timeline = [
@@ -509,15 +490,10 @@ export const applicantRouter = router({
],
},
include: {
roundProjects: {
round: {
include: {
round: {
include: {
program: { select: { name: true, year: true } },
},
},
program: { select: { name: true, year: true } },
},
orderBy: { addedAt: 'desc' },
},
files: true,
teamMembers: {