23 lines
496 B
Go
23 lines
496 B
Go
package validators
|
|
|
|
import (
|
|
"file-system/internal/api/requests"
|
|
"file-system/internal/common"
|
|
)
|
|
|
|
type UploadFileValidator struct{}
|
|
|
|
func NewUploadFileValidator() *UploadFileValidator {
|
|
return &UploadFileValidator{}
|
|
}
|
|
|
|
func (v *UploadFileValidator) Validate(req *requests.UploadFileRequest) error {
|
|
if req.BucketName == "" {
|
|
return common.NewBusinessException("Bucket name cannot be empty")
|
|
}
|
|
if req.File == nil {
|
|
return common.NewBusinessException("File is required")
|
|
}
|
|
return nil
|
|
}
|