multi dataset
This commit is contained in:
@@ -271,6 +271,25 @@ func (s *Server) HandleUploadStream(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// Check if dataset is allowed for this client
|
||||
dataset, err := s.db.GetDatasetByName(clientID, datasetName)
|
||||
if err != nil || dataset == nil {
|
||||
log.Printf("Dataset %s not found for client %s", datasetName, clientID)
|
||||
respondJSON(w, http.StatusForbidden, UploadResponse{
|
||||
Success: false,
|
||||
Message: "Dataset not configured for this client",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if !dataset.Enabled {
|
||||
respondJSON(w, http.StatusForbidden, UploadResponse{
|
||||
Success: false,
|
||||
Message: "Dataset is disabled",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
// Upload to S3
|
||||
@@ -438,13 +457,6 @@ func (s *Server) HandleDownload(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// Find snapshot metadata
|
||||
client, err := s.db.GetClient(clientID)
|
||||
if err != nil || client == nil {
|
||||
http.Error(w, "Client not found", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
targetSnapshot, err := s.db.GetSnapshotByID(clientID, snapshotID)
|
||||
if err != nil || targetSnapshot == nil {
|
||||
http.Error(w, "Snapshot not found", http.StatusNotFound)
|
||||
|
||||
Reference in New Issue
Block a user