|
1 | 1 | 'use server' |
2 | 2 |
|
3 | 3 | import { type SupabaseClient, createClient } from '@/libs/db/server' |
| 4 | +import type { Tables } from '@liam-hq/db/supabase/database.types' |
4 | 5 | import { generateKnowledgeFromFeedbackTask } from '@liam-hq/jobs' |
5 | | -import type { Review, ReviewFeedback } from '@liam-hq/jobs/src/types' |
6 | | -import { categoryToKind } from '@liam-hq/jobs/src/utils/categoryUtils' |
| 6 | +import type { Review } from '@liam-hq/jobs/src/types' |
7 | 7 | import * as v from 'valibot' |
8 | 8 |
|
| 9 | +type ReviewFeedback = Tables<'review_feedbacks'> |
| 10 | + |
| 11 | +type KindEnum = |
| 12 | + | 'Migration Safety' |
| 13 | + | 'Data Integrity' |
| 14 | + | 'Performance Impact' |
| 15 | + | 'Project Rules Consistency' |
| 16 | + | 'Security or Scalability' |
| 17 | + |
| 18 | +function categoryToKind(category: string | null | undefined): KindEnum { |
| 19 | + if (!category) return 'Migration Safety' // Default value |
| 20 | + |
| 21 | + const mapping: Record<string, KindEnum> = { |
| 22 | + MIGRATION_SAFETY: 'Migration Safety', |
| 23 | + DATA_INTEGRITY: 'Data Integrity', |
| 24 | + PERFORMANCE_IMPACT: 'Performance Impact', |
| 25 | + PROJECT_RULES_CONSISTENCY: 'Project Rules Consistency', |
| 26 | + SECURITY_OR_SCALABILITY: 'Security or Scalability', |
| 27 | + } |
| 28 | + |
| 29 | + return mapping[category] || 'Migration Safety' |
| 30 | +} |
| 31 | + |
9 | 32 | const requestSchema = v.object({ |
10 | 33 | feedbackId: v.pipe(v.string()), |
11 | 34 | resolutionComment: v.optional(v.nullable(v.string())), |
|
0 commit comments