All files / src/entities/milestones schema.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 463x       3x                 3x                 1x             3x           3x                    
import { z } from "zod";
 
// Write-only milestone operation schemas
// Schema for creating a new milestone
export const CreateProjectMilestoneSchema = z.object({
  namespace: z.string().describe("Namespace path (group or project) to create milestone in"),
  title: z.string().describe("The title of the milestone"),
  description: z.string().optional().describe("The description of the milestone"),
  due_date: z.string().optional().describe("The due date of the milestone (YYYY-MM-DD)"),
  start_date: z.string().optional().describe("The start date of the milestone (YYYY-MM-DD)"),
});
 
// Schema for editing a milestone
export const EditProjectMilestoneSchema = z.object({
  namespace: z.string().describe("Namespace path (group or project) containing the milestone"),
  milestone_id: z.coerce.string().describe("The ID of a project or group milestone"),
  title: z.string().optional().describe("The title of the milestone"),
  description: z.string().optional().describe("The description of the milestone"),
  due_date: z.string().optional().describe("The due date of the milestone (YYYY-MM-DD)"),
  start_date: z.string().optional().describe("The start date of the milestone (YYYY-MM-DD)"),
  state_event: z
    .string()
    .transform(val => val.toLowerCase())
    .pipe(z.enum(["close", "activate"]))
    .optional()
    .describe("The state event of the milestone"),
});
 
// Schema for deleting a milestone
export const DeleteProjectMilestoneSchema = z.object({
  namespace: z.string().describe("Namespace path (group or project) containing the milestone"),
  milestone_id: z.coerce.string().describe("The ID of a project or group milestone"),
});
 
// Schema for promoting a project milestone to a group milestone
export const PromoteProjectMilestoneSchema = z.object({
  namespace: z.string().describe("Namespace path (group or project) containing the milestone"),
  milestone_id: z.coerce.string().describe("The ID of a project or group milestone"),
});
 
// Type exports
export type CreateProjectMilestoneOptions = z.infer<typeof CreateProjectMilestoneSchema>;
export type EditProjectMilestoneOptions = z.infer<typeof EditProjectMilestoneSchema>;
export type DeleteProjectMilestoneOptions = z.infer<typeof DeleteProjectMilestoneSchema>;
export type PromoteProjectMilestoneOptions = z.infer<typeof PromoteProjectMilestoneSchema>;