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
|
|
|
import { z } from "zod";
|
|
|
|
|
import { APPROVAL_TYPES } from "../constants.js";
|
|
|
|
|
|
|
|
|
|
export const createApprovalSchema = z.object({
|
|
|
|
|
type: z.enum(APPROVAL_TYPES),
|
|
|
|
|
requestedByAgentId: z.string().uuid().optional().nullable(),
|
|
|
|
|
payload: z.record(z.unknown()),
|
2026-02-19 13:02:25 -06:00
|
|
|
issueIds: z.array(z.string().uuid()).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 CreateApproval = z.infer<typeof createApprovalSchema>;
|
|
|
|
|
|
|
|
|
|
export const resolveApprovalSchema = z.object({
|
|
|
|
|
decisionNote: z.string().optional().nullable(),
|
|
|
|
|
decidedByUserId: z.string().optional().default("board"),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type ResolveApproval = z.infer<typeof resolveApprovalSchema>;
|
2026-02-19 09:10:38 -06:00
|
|
|
|
|
|
|
|
export const requestApprovalRevisionSchema = z.object({
|
|
|
|
|
decisionNote: z.string().optional().nullable(),
|
|
|
|
|
decidedByUserId: z.string().optional().default("board"),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type RequestApprovalRevision = z.infer<typeof requestApprovalRevisionSchema>;
|
|
|
|
|
|
|
|
|
|
export const resubmitApprovalSchema = z.object({
|
|
|
|
|
payload: z.record(z.unknown()).optional(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type ResubmitApproval = z.infer<typeof resubmitApprovalSchema>;
|
|
|
|
|
|
|
|
|
|
export const addApprovalCommentSchema = z.object({
|
|
|
|
|
body: z.string().min(1),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type AddApprovalComment = z.infer<typeof addApprovalCommentSchema>;
|