feat: 重构内容列表接口,使用过滤器结构体简化参数传递;更新相关服务和测试用例

This commit is contained in:
2025-12-29 15:04:55 +08:00
parent 8c4bc55f45
commit fba77afec1
14 changed files with 65 additions and 60 deletions

View File

@@ -30,7 +30,7 @@ func (s *common) Upload(ctx context.Context, file *multipart.FileHeader, typeArg
objectKey := uuid.NewString() + "_" + file.Filename
url := "http://mock-storage/" + objectKey
// Determine TenantID.
// Determine TenantID.
// Uploads usually happen in context of a tenant? Or personal?
// For now assume user's owned tenant if any, or 0.
// MediaAsset has TenantID (NOT NULL).
@@ -41,7 +41,7 @@ func (s *common) Upload(ctx context.Context, file *multipart.FileHeader, typeArg
tid = t.ID
}
// If no tenant, and TenantID is NOT NULL, we have a problem for regular users uploading avatar?
// Users avatar is URL string in `users` table.
// Users avatar is URL string in `users` table.
// MediaAssets table is for TENANT content.
// If this is for user avatar upload, maybe we don't use MediaAssets?
// But `upload` endpoint is generic.
@@ -56,7 +56,7 @@ func (s *common) Upload(ctx context.Context, file *multipart.FileHeader, typeArg
Provider: "mock",
Bucket: "default",
ObjectKey: objectKey,
Meta: types.NewJSONType(fields.MediaAssetMeta{
Meta: types.NewJSONType(fields.MediaAssetMeta{
Size: file.Size,
// MimeType?
}),
@@ -73,4 +73,4 @@ func (s *common) Upload(ctx context.Context, file *multipart.FileHeader, typeArg
Size: file.Size,
MimeType: file.Header.Get("Content-Type"),
}, nil
}
}