add SHA-1 hash calculation for file uploads and update related API and model structures

This commit is contained in:
nyne
2025-05-16 15:16:01 +08:00
parent a827b67c41
commit 5431328515
8 changed files with 174 additions and 20 deletions

View File

@@ -34,6 +34,7 @@ func initUpload(c fiber.Ctx) error {
FileSize int64 `json:"file_size"`
ResourceID uint `json:"resource_id"`
StorageID uint `json:"storage_id"`
Sha1 string `json:"sha1"`
}
var req InitUploadRequest
@@ -41,7 +42,7 @@ func initUpload(c fiber.Ctx) error {
return model.NewRequestError("Invalid request parameters")
}
result, err := service.CreateUploadingFile(uid, req.Filename, req.Description, req.FileSize, req.ResourceID, req.StorageID)
result, err := service.CreateUploadingFile(uid, req.Filename, req.Description, req.FileSize, req.ResourceID, req.StorageID, req.Sha1)
if err != nil {
return err
}