refactor: tech debt batch 3 — type safety + assignment router split
All checks were successful
Build and Push Docker Image / build (push) Successful in 13m4s
All checks were successful
Build and Push Docker Image / build (push) Successful in 13m4s
#5 — Replaced 55x PrismaClient | any with proper Prisma types across 8 files - Service files: PrismaClient | any → PrismaClient, tx: any → Prisma.TransactionClient - Fixed 4 real bugs uncovered by typing: - mentor-workspace.ts: wrong FK fields (mentorAssignmentId → workspaceId, role → senderRole) - ai-shortlist.ts: untyped string passed to CompetitionCategory enum filter - result-lock.ts: unknown passed where Prisma.InputJsonValue required #9 — Split assignment.ts (2,775 lines) into 6 focused files: - shared.ts (93 lines) — MOVABLE_EVAL_STATUSES, buildBatchNotifications, getCandidateJurors - assignment-crud.ts (473 lines) — 8 core CRUD procedures - assignment-suggestions.ts (880 lines) — AI suggestions + job runner - assignment-notifications.ts (138 lines) — 2 notification procedures - assignment-redistribution.ts (1,162 lines) — 8 reassign/transfer procedures - index.ts (15 lines) — barrel export with router merge, zero frontend changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,7 @@ import { getOpenAI, getConfiguredModel, buildCompletionParams } from '@/lib/open
|
||||
import { logAIUsage, extractTokenUsage } from '@/server/utils/ai-usage'
|
||||
import { classifyAIError, logAIError } from './ai-errors'
|
||||
import { extractMultipleFileContents } from './file-content-extractor'
|
||||
import type { PrismaClient } from '@prisma/client'
|
||||
import type { PrismaClient, CompetitionCategory } from '@prisma/client'
|
||||
|
||||
// ─── Types ──────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -95,14 +95,14 @@ async function generateCategoryShortlist(
|
||||
rubric?: string
|
||||
aiParseFiles: boolean
|
||||
},
|
||||
prisma: PrismaClient | any,
|
||||
prisma: PrismaClient,
|
||||
): Promise<{ recommendations: ShortlistRecommendation[]; tokensUsed: number; errors: string[] }> {
|
||||
const { roundId, category, topN, rubric, aiParseFiles } = params
|
||||
|
||||
// Load projects with evaluations for this category
|
||||
const projects = await prisma.project.findMany({
|
||||
where: {
|
||||
competitionCategory: category,
|
||||
competitionCategory: category as CompetitionCategory,
|
||||
assignments: { some: { roundId } },
|
||||
},
|
||||
include: {
|
||||
@@ -320,7 +320,7 @@ export async function generateShortlist(
|
||||
rubric?: string
|
||||
aiParseFiles?: boolean
|
||||
},
|
||||
prisma: PrismaClient | any,
|
||||
prisma: PrismaClient,
|
||||
): Promise<ShortlistResult> {
|
||||
const {
|
||||
roundId,
|
||||
|
||||
Reference in New Issue
Block a user