feat: complete TASK-WP2-01 project foundations

This commit is contained in:
suyx
2026-07-28 20:12:12 +08:00
parent 59e566885b
commit 4d38530361
19 changed files with 3696 additions and 12 deletions
+775
View File
@@ -1317,6 +1317,50 @@
],
"type": "object"
},
"FailedEmptyTrashRequest": {
"additionalProperties": false,
"properties": {
"project_ids": {
"items": {
"$ref": "#/components/schemas/ProjectId"
},
"maxItems": 20,
"minItems": 1,
"type": "array",
"uniqueItems": true
}
},
"required": [
"project_ids"
],
"type": "object"
},
"FailedEmptyTrashResponse": {
"additionalProperties": false,
"properties": {
"ignored_project_ids": {
"items": {
"$ref": "#/components/schemas/ProjectId"
},
"maxItems": 20,
"type": "array",
"uniqueItems": true
},
"trashed_project_ids": {
"items": {
"$ref": "#/components/schemas/ProjectId"
},
"maxItems": 20,
"type": "array",
"uniqueItems": true
}
},
"required": [
"ignored_project_ids",
"trashed_project_ids"
],
"type": "object"
},
"GenerationErrorCategory": {
"anyOf": [
{
@@ -1375,6 +1419,85 @@
}
]
},
"GenerationProjectItem": {
"additionalProperties": false,
"properties": {
"created_at": {
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$",
"type": "string"
},
"error_category": {
"anyOf": [
{
"$ref": "#/components/schemas/GenerationErrorCategory"
},
{
"type": "null"
}
]
},
"generation_id": {
"pattern": "^[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}$",
"type": "string"
},
"prompt": {
"maxLength": 4000,
"minLength": 1,
"type": "string"
},
"ratio": {
"$ref": "#/components/schemas/ProjectRatio"
},
"status": {
"anyOf": [
{
"enum": [
"queued"
],
"type": "string"
},
{
"enum": [
"running"
],
"type": "string"
},
{
"enum": [
"succeeded"
],
"type": "string"
},
{
"enum": [
"failed"
],
"type": "string"
},
{
"enum": [
"rejected"
],
"type": "string"
}
]
},
"updated_at": {
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$",
"type": "string"
}
},
"required": [
"created_at",
"error_category",
"generation_id",
"prompt",
"ratio",
"status",
"updated_at"
],
"type": "object"
},
"LoginCompleteRequest": {
"additionalProperties": false,
"properties": {
@@ -1551,6 +1674,375 @@
],
"type": "object"
},
"ProjectDetailResponse": {
"additionalProperties": false,
"properties": {
"created_at": {
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$",
"type": "string"
},
"current_image_id": {
"anyOf": [
{
"$ref": "#/components/schemas/ProjectId"
},
{
"type": "null"
}
]
},
"deleted_at": {
"anyOf": [
{
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$",
"type": "string"
},
{
"type": "null"
}
]
},
"draft_prompt": {
"maxLength": 4000,
"minLength": 1,
"type": "string"
},
"generations": {
"items": {
"$ref": "#/components/schemas/GenerationProjectItem"
},
"type": "array"
},
"images": {
"items": {
"$ref": "#/components/schemas/ProjectImageItem"
},
"maxItems": 10,
"type": "array"
},
"name": {
"maxLength": 160,
"minLength": 1,
"type": "string"
},
"pixel_height": {
"minimum": 1,
"type": "integer"
},
"pixel_width": {
"minimum": 1,
"type": "integer"
},
"project_id": {
"$ref": "#/components/schemas/ProjectId"
},
"purge_at": {
"anyOf": [
{
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$",
"type": "string"
},
{
"type": "null"
}
]
},
"ratio": {
"$ref": "#/components/schemas/ProjectRatio"
},
"state_version": {
"minimum": 1,
"type": "integer"
},
"status": {
"$ref": "#/components/schemas/ProjectViewStatus"
},
"successful_image_count": {
"maximum": 10,
"minimum": 0,
"type": "integer"
},
"updated_at": {
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$",
"type": "string"
}
},
"required": [
"current_image_id",
"deleted_at",
"name",
"project_id",
"purge_at",
"ratio",
"state_version",
"status",
"successful_image_count",
"updated_at",
"created_at",
"draft_prompt",
"generations",
"images",
"pixel_height",
"pixel_width"
],
"type": "object"
},
"ProjectId": {
"pattern": "^[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}$",
"type": "string"
},
"ProjectImageItem": {
"additionalProperties": false,
"properties": {
"created_at": {
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$",
"type": "string"
},
"generation_id": {
"pattern": "^[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}$",
"type": "string"
},
"image_id": {
"$ref": "#/components/schemas/ProjectId"
}
},
"required": [
"created_at",
"generation_id",
"image_id"
],
"type": "object"
},
"ProjectListQuery": {
"additionalProperties": false,
"properties": {
"status": {
"anyOf": [
{
"enum": [
"active"
],
"type": "string"
},
{
"enum": [
"trashed"
],
"type": "string"
}
]
}
},
"type": "object"
},
"ProjectListResponse": {
"additionalProperties": false,
"properties": {
"active_count": {
"maximum": 20,
"minimum": 0,
"type": "integer"
},
"active_limit": {
"enum": [
20
],
"type": "number"
},
"projects": {
"items": {
"$ref": "#/components/schemas/ProjectSummary"
},
"maxItems": 20,
"type": "array"
}
},
"required": [
"active_count",
"active_limit",
"projects"
],
"type": "object"
},
"ProjectParams": {
"additionalProperties": false,
"properties": {
"projectId": {
"$ref": "#/components/schemas/ProjectId"
}
},
"required": [
"projectId"
],
"type": "object"
},
"ProjectRatio": {
"anyOf": [
{
"enum": [
"3:4"
],
"type": "string"
},
{
"enum": [
"1:1"
],
"type": "string"
},
{
"enum": [
"4:3"
],
"type": "string"
},
{
"enum": [
"9:16"
],
"type": "string"
}
]
},
"ProjectRenameRequest": {
"additionalProperties": false,
"properties": {
"name": {
"maxLength": 80,
"minLength": 1,
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
},
"ProjectRenameResponse": {
"additionalProperties": false,
"properties": {
"name": {
"maxLength": 80,
"minLength": 1,
"type": "string"
},
"state_version": {
"minimum": 2,
"type": "integer"
},
"status": {
"enum": [
"renamed"
],
"type": "string"
}
},
"required": [
"name",
"state_version",
"status"
],
"type": "object"
},
"ProjectSummary": {
"additionalProperties": false,
"properties": {
"current_image_id": {
"anyOf": [
{
"$ref": "#/components/schemas/ProjectId"
},
{
"type": "null"
}
]
},
"deleted_at": {
"anyOf": [
{
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$",
"type": "string"
},
{
"type": "null"
}
]
},
"name": {
"maxLength": 160,
"minLength": 1,
"type": "string"
},
"project_id": {
"$ref": "#/components/schemas/ProjectId"
},
"purge_at": {
"anyOf": [
{
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$",
"type": "string"
},
{
"type": "null"
}
]
},
"ratio": {
"$ref": "#/components/schemas/ProjectRatio"
},
"state_version": {
"minimum": 1,
"type": "integer"
},
"status": {
"$ref": "#/components/schemas/ProjectViewStatus"
},
"successful_image_count": {
"maximum": 10,
"minimum": 0,
"type": "integer"
},
"updated_at": {
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$",
"type": "string"
}
},
"required": [
"current_image_id",
"deleted_at",
"name",
"project_id",
"purge_at",
"ratio",
"state_version",
"status",
"successful_image_count",
"updated_at"
],
"type": "object"
},
"ProjectViewStatus": {
"anyOf": [
{
"enum": [
"active"
],
"type": "string"
},
{
"enum": [
"failed_empty"
],
"type": "string"
},
{
"enum": [
"trashed"
],
"type": "string"
}
]
},
"RegistrationCompleteHeaders": {
"additionalProperties": true,
"properties": {
@@ -3929,6 +4421,289 @@
]
}
},
"/api/v1/projects": {
"get": {
"operationId": "listProjects",
"parameters": [
{
"in": "query",
"name": "status",
"required": false,
"schema": {
"anyOf": [
{
"enum": [
"active"
],
"type": "string"
},
{
"enum": [
"trashed"
],
"type": "string"
}
]
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProjectListResponse"
}
}
},
"description": "Default Response"
},
"400": {
"description": "Default Response"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
}
},
"tags": [
"Projects"
]
}
},
"/api/v1/projects/{projectId}": {
"get": {
"operationId": "getProject",
"parameters": [
{
"in": "path",
"name": "projectId",
"required": true,
"schema": {
"$ref": "#/components/schemas/ProjectId"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProjectDetailResponse"
}
}
},
"description": "Default Response"
},
"400": {
"description": "Default Response"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"404": {
"description": "Default Response"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
}
},
"tags": [
"Projects"
]
},
"patch": {
"operationId": "renameProject",
"parameters": [
{
"in": "path",
"name": "projectId",
"required": true,
"schema": {
"$ref": "#/components/schemas/ProjectId"
}
},
{
"in": "header",
"name": "x-csrf-token",
"required": true,
"schema": {
"maxLength": 64,
"minLength": 43,
"pattern": "^[A-Za-z0-9_-]+$",
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProjectRenameRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProjectRenameResponse"
}
}
},
"description": "Default Response"
},
"400": {
"description": "Default Response"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"404": {
"description": "Default Response"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
}
},
"tags": [
"Projects"
]
}
},
"/api/v1/projects/failed-empty/trash": {
"post": {
"operationId": "trashFailedEmptyProjects",
"parameters": [
{
"in": "header",
"name": "x-csrf-token",
"required": true,
"schema": {
"maxLength": 64,
"minLength": 43,
"pattern": "^[A-Za-z0-9_-]+$",
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FailedEmptyTrashRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FailedEmptyTrashResponse"
}
}
},
"description": "Default Response"
},
"400": {
"description": "Default Response"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"403": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
}
},
"tags": [
"Projects"
]
}
},
"/api/v1/support/check": {
"post": {
"operationId": "checkBrowserSupport",