feat: implement TASK-WP1-05 account deletion

This commit is contained in:
suyx
2026-07-28 19:07:11 +08:00
parent 03f1509de7
commit 2358f97e5c
20 changed files with 2565 additions and 13 deletions
+584
View File
@@ -1,6 +1,265 @@
{
"components": {
"schemas": {
"AccountDeletionCompleteRequest": {
"additionalProperties": false,
"properties": {
"confirmation": {
"enum": [
"注销账号"
],
"type": "string"
},
"deletion_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"
},
"verification_code": {
"pattern": "^[0-9]{6}$",
"type": "string"
}
},
"required": [
"confirmation",
"deletion_id",
"verification_code"
],
"type": "object"
},
"AccountDeletionResponse": {
"additionalProperties": false,
"properties": {
"status": {
"enum": [
"deleted"
],
"type": "string"
}
},
"required": [
"status"
],
"type": "object"
},
"AccountDeletionSendResponse": {
"additionalProperties": false,
"properties": {
"challenge_expires_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"
},
"deletion_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"
},
"resend_available_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"
},
"status": {
"enum": [
"verification_sent"
],
"type": "string"
}
},
"required": [
"challenge_expires_at",
"deletion_id",
"resend_available_at",
"status"
],
"type": "object"
},
"AccountProfileUpdateRequest": {
"additionalProperties": false,
"properties": {
"creator_name": {
"maxLength": 80,
"minLength": 1,
"type": "string"
},
"social_id": {
"maxLength": 80,
"minLength": 1,
"type": "string"
}
},
"required": [
"creator_name",
"social_id"
],
"type": "object"
},
"AccountProfileUpdateResponse": {
"additionalProperties": false,
"properties": {
"profile": {
"additionalProperties": false,
"properties": {
"creator_name": {
"maxLength": 80,
"minLength": 1,
"type": "string"
},
"social_id": {
"maxLength": 80,
"minLength": 1,
"type": "string"
}
},
"required": [
"creator_name",
"social_id"
],
"type": "object"
},
"status": {
"enum": [
"saved"
],
"type": "string"
}
},
"required": [
"profile",
"status"
],
"type": "object"
},
"AccountSettingsResponse": {
"additionalProperties": false,
"properties": {
"account": {
"additionalProperties": false,
"properties": {
"email": {
"maxLength": 320,
"pattern": "^[^@\\s]{1,128}@[^@\\s]{1,190}$",
"type": "string"
},
"status": {
"enum": [
"active"
],
"type": "string"
}
},
"required": [
"email",
"status"
],
"type": "object"
},
"csrf_token": {
"maxLength": 64,
"minLength": 43,
"pattern": "^[A-Za-z0-9_-]+$",
"type": "string"
},
"local_data": {
"additionalProperties": false,
"properties": {
"backup_enabled": {
"enum": [
false
],
"type": "boolean"
},
"capacity_status": {
"anyOf": [
{
"enum": [
"normal"
],
"type": "string"
},
{
"enum": [
"warning"
],
"type": "string"
},
{
"enum": [
"critical"
],
"type": "string"
},
{
"enum": [
"full"
],
"type": "string"
},
{
"enum": [
"unavailable"
],
"type": "string"
}
]
},
"hard_limit_bytes": {
"minimum": 1,
"type": "integer"
},
"location": {
"enum": [
"configured_local_data_root"
],
"type": "string"
},
"managed_content_bytes": {
"minimum": 0,
"type": "integer"
},
"migration_supported": {
"enum": [
false
],
"type": "boolean"
}
},
"required": [
"backup_enabled",
"capacity_status",
"hard_limit_bytes",
"location",
"managed_content_bytes",
"migration_supported"
],
"type": "object"
},
"profile": {
"additionalProperties": false,
"properties": {
"creator_name": {
"maxLength": 80,
"minLength": 1,
"type": "string"
},
"social_id": {
"maxLength": 80,
"minLength": 1,
"type": "string"
}
},
"required": [
"creator_name",
"social_id"
],
"type": "object"
}
},
"required": [
"account",
"csrf_token",
"local_data",
"profile"
],
"type": "object"
},
"AdminAuthenticatedUser": {
"additionalProperties": false,
"properties": {
@@ -549,6 +808,21 @@
],
"type": "object"
},
"CsrfHeaders": {
"additionalProperties": true,
"properties": {
"x-csrf-token": {
"maxLength": 64,
"minLength": 43,
"pattern": "^[A-Za-z0-9_-]+$",
"type": "string"
}
},
"required": [
"x-csrf-token"
],
"type": "object"
},
"ErrorDetails": {
"additionalProperties": false,
"properties": {
@@ -1718,6 +1992,316 @@
},
"openapi": "3.1.0",
"paths": {
"/api/v1/account/deletion/complete": {
"post": {
"operationId": "completeAccountDeletion",
"parameters": [
{
"in": "header",
"name": "idempotency-key",
"required": true,
"schema": {
"maxLength": 200,
"minLength": 32,
"pattern": "^[A-Za-z0-9_-]+$",
"type": "string"
}
},
{
"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/AccountDeletionCompleteRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AccountDeletionResponse"
}
}
},
"description": "Default Response"
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"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"
},
"409": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
}
},
"tags": [
"Account"
]
}
},
"/api/v1/account/deletion/send": {
"post": {
"operationId": "sendAccountDeletionCode",
"parameters": [
{
"in": "header",
"name": "x-csrf-token",
"required": true,
"schema": {
"maxLength": 64,
"minLength": 43,
"pattern": "^[A-Za-z0-9_-]+$",
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AccountDeletionSendResponse"
}
}
},
"description": "Default Response"
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"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"
},
"429": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"description": "Default Response"
}
},
"tags": [
"Account"
]
}
},
"/api/v1/account/settings": {
"get": {
"operationId": "getAccountSettings",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AccountSettingsResponse"
}
}
},
"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": [
"Account"
]
}
},
"/api/v1/account/settings/profile": {
"put": {
"operationId": "updateAccountProfile",
"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/AccountProfileUpdateRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AccountProfileUpdateResponse"
}
}
},
"description": "Default Response"
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
},
"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": [
"Account"
]
}
},
"/api/v1/admin-auth/login/complete": {
"post": {
"operationId": "completeAdminLogin",