2026-02-16 13:31:47 -06:00
|
|
|
import { z } from "zod";
|
|
|
|
|
import { ISSUE_PRIORITIES, ISSUE_STATUSES } from "../constants.js";
|
|
|
|
|
|
|
|
|
|
export const createIssueSchema = z.object({
|
Expand data model with companies, approvals, costs, and heartbeats
Add new DB schemas: companies, agent_api_keys, approvals, cost_events,
heartbeat_runs, issue_comments. Add corresponding shared types and
validators. Update existing schemas (agents, goals, issues, projects)
with new fields for company association, budgets, and richer metadata.
Generate initial Drizzle migration. Update seed data.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:22 -06:00
|
|
|
projectId: z.string().uuid().optional().nullable(),
|
|
|
|
|
goalId: z.string().uuid().optional().nullable(),
|
|
|
|
|
parentId: z.string().uuid().optional().nullable(),
|
2026-02-16 13:31:47 -06:00
|
|
|
title: z.string().min(1),
|
|
|
|
|
description: z.string().optional().nullable(),
|
|
|
|
|
status: z.enum(ISSUE_STATUSES).optional().default("backlog"),
|
|
|
|
|
priority: z.enum(ISSUE_PRIORITIES).optional().default("medium"),
|
Expand data model with companies, approvals, costs, and heartbeats
Add new DB schemas: companies, agent_api_keys, approvals, cost_events,
heartbeat_runs, issue_comments. Add corresponding shared types and
validators. Update existing schemas (agents, goals, issues, projects)
with new fields for company association, budgets, and richer metadata.
Generate initial Drizzle migration. Update seed data.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:22 -06:00
|
|
|
assigneeAgentId: z.string().uuid().optional().nullable(),
|
|
|
|
|
requestDepth: z.number().int().nonnegative().optional().default(0),
|
|
|
|
|
billingCode: z.string().optional().nullable(),
|
2026-02-16 13:31:47 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type CreateIssue = z.infer<typeof createIssueSchema>;
|
|
|
|
|
|
2026-02-17 20:46:12 -06:00
|
|
|
export const updateIssueSchema = createIssueSchema.partial().extend({
|
|
|
|
|
comment: z.string().min(1).optional(),
|
2026-02-19 15:43:43 -06:00
|
|
|
hiddenAt: z.string().datetime().nullable().optional(),
|
2026-02-17 20:46:12 -06:00
|
|
|
});
|
2026-02-16 13:31:47 -06:00
|
|
|
|
|
|
|
|
export type UpdateIssue = z.infer<typeof updateIssueSchema>;
|
Expand data model with companies, approvals, costs, and heartbeats
Add new DB schemas: companies, agent_api_keys, approvals, cost_events,
heartbeat_runs, issue_comments. Add corresponding shared types and
validators. Update existing schemas (agents, goals, issues, projects)
with new fields for company association, budgets, and richer metadata.
Generate initial Drizzle migration. Update seed data.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:22 -06:00
|
|
|
|
|
|
|
|
export const checkoutIssueSchema = z.object({
|
|
|
|
|
agentId: z.string().uuid(),
|
|
|
|
|
expectedStatuses: z.array(z.enum(ISSUE_STATUSES)).nonempty(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type CheckoutIssue = z.infer<typeof checkoutIssueSchema>;
|
|
|
|
|
|
|
|
|
|
export const addIssueCommentSchema = z.object({
|
|
|
|
|
body: z.string().min(1),
|
2026-02-19 09:09:26 -06:00
|
|
|
reopen: z.boolean().optional(),
|
Expand data model with companies, approvals, costs, and heartbeats
Add new DB schemas: companies, agent_api_keys, approvals, cost_events,
heartbeat_runs, issue_comments. Add corresponding shared types and
validators. Update existing schemas (agents, goals, issues, projects)
with new fields for company association, budgets, and richer metadata.
Generate initial Drizzle migration. Update seed data.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:22 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type AddIssueComment = z.infer<typeof addIssueCommentSchema>;
|
2026-02-19 13:02:25 -06:00
|
|
|
|
|
|
|
|
export const linkIssueApprovalSchema = z.object({
|
|
|
|
|
approvalId: z.string().uuid(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type LinkIssueApproval = z.infer<typeof linkIssueApprovalSchema>;
|
2026-02-20 10:31:56 -06:00
|
|
|
|
|
|
|
|
export const createIssueAttachmentMetadataSchema = z.object({
|
|
|
|
|
issueCommentId: z.string().uuid().optional().nullable(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type CreateIssueAttachmentMetadata = z.infer<typeof createIssueAttachmentMetadataSchema>;
|