file-system/internal/api/validators/share_validator.go
向宁 3a18ca0579 feat: add directory structure and file sharing support
- PostgreSQL metadata overlay layer on top of existing S3 storage
- 3 new tables: folders, files, share_links
- Folder CRUD: create, get with children, tree, rename, delete (cascade)
- File operations: upload to folder, move between folders
- Share links: create with optional password/expiry/download limit, public access
- S3 compensation on PG write failure
- Existing 14 endpoints untouched
2026-05-20 20:26:19 +08:00

23 lines
549 B
Go

package validators
import (
"rag/file-system/internal/api/requests"
"rag/file-system/internal/common"
)
type ShareValidator struct{}
func NewShareValidator() *ShareValidator {
return &ShareValidator{}
}
func (v *ShareValidator) ValidateCreate(req *requests.CreateShareRequest) error {
if req.ResourceType != "file" && req.ResourceType != "folder" {
return common.NewBusinessException("resource_type 必须是 file 或 folder")
}
if req.ResourceID == "" {
return common.NewBusinessException("resource_id 不能为空")
}
return nil
}