feat: complete TASK-WP2-07 latest exports
This commit is contained in:
@@ -69,6 +69,21 @@ export const ProjectImageItemSchema = Type.Object(
|
||||
},
|
||||
{ additionalProperties: false, $id: "ProjectImageItem" },
|
||||
);
|
||||
export const ExportFormatSchema = Type.Union([Type.Literal("jpg"), Type.Literal("png")], { $id: "ExportFormat" });
|
||||
export const LatestExportItemSchema = Type.Object(
|
||||
{
|
||||
byte_size: Type.Integer({ minimum: 1 }),
|
||||
created_at: Type.String({ pattern: isoTimestampPattern }),
|
||||
download_url: Type.String({ pattern: "^/api/v1/projects/[0-9a-fA-F-]{36}/latest-exports/(jpg|png)$" }),
|
||||
export_id: Type.String({ pattern: uuidPattern }),
|
||||
format: Type.Ref(ExportFormatSchema),
|
||||
pixel_height: Type.Integer({ minimum: 1 }),
|
||||
pixel_width: Type.Integer({ minimum: 1 }),
|
||||
sha256: Type.String({ pattern: "^[0-9a-f]{64}$" }),
|
||||
state_version: Type.Integer({ minimum: 1 }),
|
||||
},
|
||||
{ additionalProperties: false, $id: "LatestExportItem" },
|
||||
);
|
||||
export const ProjectDetailResponseSchema = Type.Object(
|
||||
{
|
||||
...ProjectSummarySchema.properties,
|
||||
@@ -77,12 +92,41 @@ export const ProjectDetailResponseSchema = Type.Object(
|
||||
draft_prompt: Type.String({ maxLength: 4_000, minLength: 1 }),
|
||||
generations: Type.Array(Type.Ref(GenerationProjectItemSchema)),
|
||||
images: Type.Array(Type.Ref(ProjectImageItemSchema), { maxItems: 10 }),
|
||||
latest_exports: Type.Array(Type.Ref(LatestExportItemSchema), { maxItems: 2 }),
|
||||
pixel_height: Type.Integer({ minimum: 1 }),
|
||||
pixel_width: Type.Integer({ minimum: 1 }),
|
||||
save_status: Type.Literal("saved"),
|
||||
},
|
||||
{ additionalProperties: false, $id: "ProjectDetailResponse" },
|
||||
);
|
||||
export const LatestExportParamsSchema = Type.Object(
|
||||
{ format: Type.Ref(ExportFormatSchema), projectId: Type.Ref(ProjectIdSchema) },
|
||||
{ additionalProperties: false, $id: "LatestExportParams" },
|
||||
);
|
||||
export const ProjectImageParamsSchema = Type.Object(
|
||||
{ imageId: Type.Ref(ProjectIdSchema), projectId: Type.Ref(ProjectIdSchema) },
|
||||
{ additionalProperties: false, $id: "ProjectImageParams" },
|
||||
);
|
||||
export const LatestExportMultipartBodySchema = Type.Object(
|
||||
{
|
||||
byte_size: Type.String({ pattern: "^[1-9][0-9]*$" }),
|
||||
export_file: Type.String({ format: "binary" }),
|
||||
export_id: Type.String({ pattern: uuidPattern }),
|
||||
format: Type.Ref(ExportFormatSchema),
|
||||
pixel_height: Type.String({ pattern: "^[1-9][0-9]*$" }),
|
||||
pixel_width: Type.String({ pattern: "^[1-9][0-9]*$" }),
|
||||
sha256: Type.String({ pattern: "^[0-9a-f]{64}$" }),
|
||||
state_version: Type.String({ pattern: "^[1-9][0-9]*$" }),
|
||||
},
|
||||
{ additionalProperties: false, $id: "LatestExportMultipartBody" },
|
||||
);
|
||||
export const LatestExportSaveResponseSchema = Type.Object(
|
||||
{
|
||||
...LatestExportItemSchema.properties,
|
||||
status: Type.Literal("saved"),
|
||||
},
|
||||
{ additionalProperties: false, $id: "LatestExportSaveResponse" },
|
||||
);
|
||||
export const ProjectRenameRequestSchema = Type.Object(
|
||||
{ name: Type.String({ maxLength: 80, minLength: 1 }) },
|
||||
{ additionalProperties: false, $id: "ProjectRenameRequest" },
|
||||
@@ -134,5 +178,7 @@ export const ProjectPurgeResponseSchema = Type.Object(
|
||||
|
||||
export type ProjectListQuery = Static<typeof ProjectListQuerySchema>;
|
||||
export type ProjectParams = Static<typeof ProjectParamsSchema>;
|
||||
export type LatestExportParams = Static<typeof LatestExportParamsSchema>;
|
||||
export type ProjectImageParams = Static<typeof ProjectImageParamsSchema>;
|
||||
export type ProjectRenameRequest = Static<typeof ProjectRenameRequestSchema>;
|
||||
export type FailedEmptyTrashRequest = Static<typeof FailedEmptyTrashRequestSchema>;
|
||||
|
||||
Reference in New Issue
Block a user