dow-prod-tracker/src/lib/validators/feedback.ts
Leivur R. Djurhuus db82eb4fed refactor: simplify feedback from 4-level severity to action item / info callout
Replace FeedbackSeverity enum (Critical/Major/Minor/Suggestion) with a
simple isActionItem boolean. Annotations default to action items (things
the artist must fix). Any item can be toggled to an info callout (context
that doesn't need action). Progress bar and carry-forward only count
action items. Screenshot paste limited to 5MB with user notification.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 22:19:31 -05:00

42 lines
1.2 KiB
TypeScript

import { z } from "zod/v4";
const feedbackStatusEnum = z.enum([
"OPEN",
"IN_PROGRESS",
"RESOLVED",
"VERIFIED",
"REOPENED",
]);
export const createFeedbackSchema = z.object({
revisionId: z.string().min(1, "Revision ID is required"),
annotationId: z.string().optional(),
commentId: z.string().optional(),
summary: z.string().min(1, "Summary is required"),
isActionItem: z.boolean().optional(), // default true
assignedToId: z.string().optional(),
});
export type CreateFeedbackInput = z.infer<typeof createFeedbackSchema>;
export const updateFeedbackSchema = z.object({
summary: z.string().min(1).optional(),
isActionItem: z.boolean().optional(),
status: feedbackStatusEnum.optional(),
assignedToId: z.string().nullable().optional(),
sortOrder: z.number().int().optional(),
});
export type UpdateFeedbackInput = z.infer<typeof updateFeedbackSchema>;
export const resolveFeedbackSchema = z.object({
resolutionNote: z.string().optional(),
});
export type ResolveFeedbackInput = z.infer<typeof resolveFeedbackSchema>;
export const verifyFeedbackSchema = z.object({
reopen: z.boolean().optional(),
});
export type VerifyFeedbackInput = z.infer<typeof verifyFeedbackSchema>;