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

@@ -249,6 +249,89 @@ definitions:
description: UserID 目标用户ID。
type: integer
type: object
dto.AdminMediaAssetUploadCompleteForm:
properties:
content_type:
description: |-
ContentType is the MIME type observed during upload; optional.
Server may record it for audit and later processing decisions.
type: string
etag:
description: |-
ETag is the storage returned ETag (or similar checksum); optional.
Used for audit/debugging and later integrity verification.
type: string
file_size:
description: |-
FileSize is the uploaded object size in bytes; optional.
Server records it for quota/audit and later validation.
type: integer
sha256:
description: |-
SHA256 is the hex-encoded sha256 of the uploaded object; optional.
Server records it for integrity checks/deduplication.
type: string
type: object
dto.AdminMediaAssetUploadInitForm:
properties:
content_type:
description: |-
ContentType is the MIME type reported by the client (e.g. video/mp4); optional.
Server 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.
Used 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.
Used for deduplication/audit; server may validate it later during upload-complete.
type: string
type:
description: |-
Type is the media asset type (video/audio/image).
Used to decide processing pipeline and validation rules; required.
type: string
type: object
dto.AdminMediaAssetUploadInitResponse:
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:
additionalProperties:
type: string
description: FormFields are form fields required for multipart form upload
(S3 POST policy); optional.
type: object
headers:
additionalProperties:
type: string
description: Headers are additional headers required for upload (e.g. signed
headers); optional.
type: object
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
type: object
dto.AdminOrderDetail:
properties:
order:
@@ -1838,6 +1921,63 @@ paths:
summary: 拒绝加入申请(租户管理)
tags:
- Tenant
/t/{tenantCode}/v1/admin/media_assets/{assetID}/upload_complete:
post:
consumes:
- application/json
parameters:
- description: Tenant Code
in: path
name: tenantCode
required: true
type: string
- description: AssetID
format: int64
in: path
name: assetID
required: true
type: integer
- description: Form
in: body
name: form
schema:
$ref: '#/definitions/dto.AdminMediaAssetUploadCompleteForm'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.MediaAsset'
summary: 确认上传完成并进入处理(租户管理)
tags:
- Tenant
/t/{tenantCode}/v1/admin/media_assets/upload_init:
post:
consumes:
- application/json
parameters:
- description: Tenant Code
in: path
name: tenantCode
required: true
type: string
- description: Form
in: body
name: form
required: true
schema:
$ref: '#/definitions/dto.AdminMediaAssetUploadInitForm'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.AdminMediaAssetUploadInitResponse'
summary: 初始化媒体资源上传(租户管理)
tags:
- Tenant
/t/{tenantCode}/v1/admin/orders:
get:
consumes: