All files / src/entities/labels schema.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 0/0
100% Lines 4/4

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 46 47 48 49 50 512x         2x                                 2x                                     2x                  
import { z } from "zod";
 
// WRITE LABEL OPERATION SCHEMAS
 
// Label operations (write)
export const CreateLabelSchema = z.object({
  namespace: z.string().describe("Namespace path (group or project) to create label in"),
  name: z.string().describe("The name of the label"),
  color: z
    .string()
    .describe(
      "The color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB) or one of the CSS color names"
    ),
  description: z.string().optional().describe("The description of the label"),
  priority: z
    .number()
    .optional()
    .describe(
      "The priority of the label. Must be greater or equal than zero or null to remove the priority"
    ),
});
 
export const UpdateLabelSchema = z.object({
  namespace: z.string().describe("Namespace path (group or project) containing the label"),
  label_id: z.union([z.coerce.string(), z.string()]).describe("The ID or title of the label"),
  new_name: z.string().optional().describe("The new name of the label"),
  color: z
    .string()
    .optional()
    .describe(
      "The color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB) or one of the CSS color names"
    ),
  description: z.string().optional().describe("The description of the label"),
  priority: z
    .number()
    .optional()
    .describe(
      "The priority of the label. Must be greater or equal than zero or null to remove the priority"
    ),
});
 
export const DeleteLabelSchema = z.object({
  namespace: z.string().describe("Namespace path (group or project) containing the label"),
  label_id: z.union([z.coerce.string(), z.string()]).describe("The ID or title of the label"),
});
 
// Export type definitions
export type CreateLabelOptions = z.infer<typeof CreateLabelSchema>;
export type UpdateLabelOptions = z.infer<typeof UpdateLabelSchema>;
export type DeleteLabelOptions = z.infer<typeof DeleteLabelSchema>;