feat: 添加媒体资产上传初始化和完成相关API接口及数据结构

This commit is contained in:
2025-12-22 17:02:53 +08:00
parent 6ab65817d8
commit 76f639b3f3
12 changed files with 959 additions and 19 deletions

View File

@@ -933,6 +933,93 @@
}
}
},
"/t/{tenantCode}/v1/admin/media_assets/upload_init": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Tenant"
],
"summary": "初始化媒体资源上传(租户管理)",
"parameters": [
{
"type": "string",
"description": "Tenant Code",
"name": "tenantCode",
"in": "path",
"required": true
},
{
"description": "Form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.AdminMediaAssetUploadInitForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.AdminMediaAssetUploadInitResponse"
}
}
}
}
},
"/t/{tenantCode}/v1/admin/media_assets/{assetID}/upload_complete": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Tenant"
],
"summary": "确认上传完成并进入处理(租户管理)",
"parameters": [
{
"type": "string",
"description": "Tenant Code",
"name": "tenantCode",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "AssetID",
"name": "assetID",
"in": "path",
"required": true
},
{
"description": "Form",
"name": "form",
"in": "body",
"schema": {
"$ref": "#/definitions/dto.AdminMediaAssetUploadCompleteForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.MediaAsset"
}
}
}
}
},
"/t/{tenantCode}/v1/admin/orders": {
"get": {
"consumes": [
@@ -2695,6 +2782,91 @@
}
}
},
"dto.AdminMediaAssetUploadCompleteForm": {
"type": "object",
"properties": {
"content_type": {
"description": "ContentType is the MIME type observed during upload; optional.\nServer may record it for audit and later processing decisions.",
"type": "string"
},
"etag": {
"description": "ETag is the storage returned ETag (or similar checksum); optional.\nUsed for audit/debugging and later integrity verification.",
"type": "string"
},
"file_size": {
"description": "FileSize is the uploaded object size in bytes; optional.\nServer records it for quota/audit and later validation.",
"type": "integer"
},
"sha256": {
"description": "SHA256 is the hex-encoded sha256 of the uploaded object; optional.\nServer records it for integrity checks/deduplication.",
"type": "string"
}
}
},
"dto.AdminMediaAssetUploadInitForm": {
"type": "object",
"properties": {
"content_type": {
"description": "ContentType is the MIME type reported by the client (e.g. video/mp4); optional.\nServer should not fully trust it, but can use it as a hint for validation/logging.",
"type": "string"
},
"file_size": {
"description": "FileSize is the expected file size in bytes; optional.\nUsed for quota/limit checks and audit; client may omit when unknown.",
"type": "integer"
},
"sha256": {
"description": "SHA256 is the hex-encoded sha256 of the file; optional.\nUsed for deduplication/audit; server may validate it later during upload-complete.",
"type": "string"
},
"type": {
"description": "Type is the media asset type (video/audio/image).\nUsed to decide processing pipeline and validation rules; required.",
"type": "string"
}
}
},
"dto.AdminMediaAssetUploadInitResponse": {
"type": "object",
"properties": {
"asset_id": {
"description": "AssetID is the created media asset id.",
"type": "integer"
},
"bucket": {
"description": "Bucket is the target bucket/container; for debugging/audit (may be empty in stub mode).",
"type": "string"
},
"expires_at": {
"description": "ExpiresAt indicates when UploadURL/FormFields expire; optional.",
"type": "string"
},
"form_fields": {
"description": "FormFields are form fields required for multipart form upload (S3 POST policy); optional.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"headers": {
"description": "Headers are additional headers required for upload (e.g. signed headers); optional.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"object_key": {
"description": "ObjectKey is the server-generated object key/path; client must NOT choose it.",
"type": "string"
},
"provider": {
"description": "Provider is the storage provider identifier (e.g. s3/minio/oss/local); for debugging/audit.",
"type": "string"
},
"upload_url": {
"description": "UploadURL is the URL the client should upload to (signed URL or service endpoint).",
"type": "string"
}
}
},
"dto.AdminOrderDetail": {
"type": "object",
"properties": {