feat: complete TASK-WP2-02 project autosave

This commit is contained in:
suyx
2026-08-02 18:28:07 +08:00
parent 4d38530361
commit da6fa25e60
17 changed files with 2268 additions and 35 deletions
@@ -1,6 +1,7 @@
import { Type, type Static } from "@sinclair/typebox";
import { GenerationErrorCategorySchema } from "./api.js";
import { CanvasStateSchema } from "./canvas.js";
const uuidPattern = "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$";
const isoTimestampPattern = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$";
@@ -71,12 +72,14 @@ export const ProjectImageItemSchema = Type.Object(
export const ProjectDetailResponseSchema = Type.Object(
{
...ProjectSummarySchema.properties,
canvas_state: Type.Ref(CanvasStateSchema),
created_at: Type.String({ pattern: isoTimestampPattern }),
draft_prompt: Type.String({ maxLength: 4_000, minLength: 1 }),
generations: Type.Array(Type.Ref(GenerationProjectItemSchema)),
images: Type.Array(Type.Ref(ProjectImageItemSchema), { maxItems: 10 }),
pixel_height: Type.Integer({ minimum: 1 }),
pixel_width: Type.Integer({ minimum: 1 }),
save_status: Type.Literal("saved"),
},
{ additionalProperties: false, $id: "ProjectDetailResponse" },
);