Add file management API with local storage backend

- Implement FileHandler with CRUD operations for files/directories
- Add FileService with business logic and SHA-256 hashing
- Create LocalStorage backend for filesystem persistence
- Add database repository with pagination and name uniqueness
  constraints
- Configure max upload size in storage settings
- Include comprehensive tests for all layers
This commit is contained in:
2026-06-24 14:08:57 +08:00
parent eaa31efd64
commit e2af482cc9
17 changed files with 1815 additions and 15 deletions
+7 -2
View File
@@ -39,8 +39,9 @@ type PostgresConfig struct {
}
type StorageConfig struct {
Driver string `mapstructure:"driver"`
Local LocalStorageConfig `mapstructure:"local"`
Driver string `mapstructure:"driver"`
Local LocalStorageConfig `mapstructure:"local"`
MaxUploadSize int64 `mapstructure:"max_upload_size"`
}
type LocalStorageConfig struct {
@@ -90,6 +91,10 @@ func (c *Config) Validate() error {
errs = append(errs, errors.New("storage.local.path: must not be empty"))
}
if c.Storage.MaxUploadSize < 0 {
errs = append(errs, errors.New("storage.max_upload_size: must not be negative"))
}
if c.JWT.Secret == "" {
errs = append(errs, errors.New("jwt.secret: must not be empty"))
}