feat(final-docs): notify mentor when a finalist uploads a Grand Final document
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ import { generateLogoKey, createStorageProvider, type StorageProviderType } from
|
||||
import { getImageUploadUrl, confirmImageUpload, getImageUrl, deleteImage, type ImageUploadConfig } from '@/server/utils/image-upload'
|
||||
import { sendStyledNotificationEmail, sendTeamMemberInviteEmail } from '@/lib/email'
|
||||
import { logAudit } from '@/server/utils/audit'
|
||||
import { createNotification } from '../services/in-app-notification'
|
||||
import { createNotification, notifyProjectMentors, NotificationTypes } from '../services/in-app-notification'
|
||||
import { checkRequirementsAndTransition, triggerInProgressOnActivity, transitionProject, isTerminalState } from '../services/round-engine'
|
||||
import { getFinalDocumentStatusForProject } from '../services/final-documents'
|
||||
import { EvaluationConfigSchema, MentoringConfigSchema } from '@/types/competition-configs'
|
||||
@@ -499,6 +499,24 @@ export const applicantRouter = router({
|
||||
console.warn('[DocAnalyzer] Post-upload analysis failed:', err))
|
||||
).catch(() => {})
|
||||
|
||||
// Notify the team's mentor(s) when a Grand-Final document is uploaded.
|
||||
if (input.roundId) {
|
||||
try {
|
||||
const round = await ctx.prisma.round.findUnique({ where: { id: input.roundId }, select: { roundType: true } })
|
||||
if (round?.roundType === 'LIVE_FINAL') {
|
||||
await notifyProjectMentors(input.projectId, {
|
||||
type: NotificationTypes.GRAND_FINAL_DOCS_SUBMITTED,
|
||||
title: 'Final document uploaded',
|
||||
message: `A team uploaded a Grand Final document: ${input.fileName}`,
|
||||
linkUrl: `/mentor/workspace/${input.projectId}`,
|
||||
metadata: { projectId: input.projectId, fileName: input.fileName },
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[final-docs] mentor notify failed', e)
|
||||
}
|
||||
}
|
||||
|
||||
return file
|
||||
}),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user