Redesign AI Tagging dialog and add edition-wide tagging
- Redesign AI Tagging dialog with scope selection (Round vs Edition) - Add visual progress indicator during AI processing - Display result stats (tagged/skipped/failed) after completion - Add batchTagProgramProjects endpoint for edition-wide tagging - Fix getFilterOptions to include program.id for filtering - Improve error handling with toast notifications Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -161,7 +161,7 @@ export const projectRouter = router({
|
||||
.query(async ({ ctx }) => {
|
||||
const [rounds, countries, categories, issues] = await Promise.all([
|
||||
ctx.prisma.round.findMany({
|
||||
select: { id: true, name: true, program: { select: { name: true, year: true } } },
|
||||
select: { id: true, name: true, program: { select: { id: true, name: true, year: true } } },
|
||||
orderBy: [{ program: { year: 'desc' } }, { createdAt: 'asc' }],
|
||||
}),
|
||||
ctx.prisma.project.findMany({
|
||||
|
||||
@@ -4,6 +4,7 @@ import { router, adminProcedure, protectedProcedure } from '../trpc'
|
||||
import {
|
||||
tagProject,
|
||||
batchTagProjects,
|
||||
batchTagProgramProjects,
|
||||
getTagSuggestions,
|
||||
addProjectTag,
|
||||
removeProjectTag,
|
||||
@@ -494,6 +495,34 @@ export const tagRouter = router({
|
||||
return result
|
||||
}),
|
||||
|
||||
/**
|
||||
* Batch tag all untagged projects in an entire program (edition)
|
||||
*/
|
||||
batchTagProgramProjects: adminProcedure
|
||||
.input(z.object({ programId: z.string() }))
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
const result = await batchTagProgramProjects(input.programId, ctx.user.id)
|
||||
|
||||
// Audit log
|
||||
await ctx.prisma.auditLog.create({
|
||||
data: {
|
||||
userId: ctx.user.id,
|
||||
action: 'BATCH_AI_TAG',
|
||||
entityType: 'Program',
|
||||
entityId: input.programId,
|
||||
detailsJson: {
|
||||
processed: result.processed,
|
||||
failed: result.failed,
|
||||
skipped: result.skipped,
|
||||
},
|
||||
ipAddress: ctx.ip,
|
||||
userAgent: ctx.userAgent,
|
||||
},
|
||||
})
|
||||
|
||||
return result
|
||||
}),
|
||||
|
||||
/**
|
||||
* Manually add a tag to a project
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user