feat: Introduce MediaAssetVariant for better asset management
- Added MediaAssetVariant enum with values 'main' and 'preview'. - Updated media asset service logic to utilize MediaAssetVariant for variant handling. - Refactored database models and queries to include variant and source_asset_id fields. - Enhanced validation for asset variants in upload and processing functions. - Updated Swagger documentation to reflect new variant structure and descriptions. - Implemented necessary database migrations to support the new variant constraints.
This commit is contained in:
@@ -84,6 +84,14 @@ definitions:
|
||||
- MediaAssetTypeVideo
|
||||
- MediaAssetTypeAudio
|
||||
- MediaAssetTypeImage
|
||||
consts.MediaAssetVariant:
|
||||
enum:
|
||||
- main
|
||||
- preview
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- MediaAssetVariantMain
|
||||
- MediaAssetVariantPreview
|
||||
consts.OrderStatus:
|
||||
enum:
|
||||
- created
|
||||
@@ -299,10 +307,11 @@ definitions:
|
||||
Used to decide processing pipeline and validation rules; required.
|
||||
type: string
|
||||
variant:
|
||||
allOf:
|
||||
- $ref: '#/definitions/consts.MediaAssetVariant'
|
||||
description: |-
|
||||
Variant indicates whether this asset is a main or preview product.
|
||||
Allowed: main/preview; default is main.
|
||||
type: string
|
||||
type: object
|
||||
dto.AdminMediaAssetUploadInitResponse:
|
||||
properties:
|
||||
@@ -976,6 +985,9 @@ definitions:
|
||||
provider:
|
||||
description: 存储提供方:例如 s3/minio/oss;便于多存储扩展
|
||||
type: string
|
||||
source_asset_id:
|
||||
description: 派生来源资源ID:preview 产物可指向对应 main 资源;用于建立 preview/main 的 1:1 追溯关系
|
||||
type: integer
|
||||
status:
|
||||
allOf:
|
||||
- $ref: '#/definitions/consts.MediaAssetStatus'
|
||||
@@ -993,6 +1005,10 @@ definitions:
|
||||
user_id:
|
||||
description: 用户ID:资源上传者;用于审计与权限控制
|
||||
type: integer
|
||||
variant:
|
||||
allOf:
|
||||
- $ref: '#/definitions/consts.MediaAssetVariant'
|
||||
description: 产物类型:main/preview;用于强制试看资源必须绑定独立产物,避免用正片绕过
|
||||
type: object
|
||||
models.Order:
|
||||
properties:
|
||||
|
||||
Reference in New Issue
Block a user