Add testing for file uploading and correct minors bugs in service
Some checks failed
Build and test backend / Build-backend (pull_request) Failing after 3m14s
Build and test backend / Test-backend (pull_request) Failing after 2m30s
Build and test FrontEnd / Build-frontend (pull_request) Successful in 26s

This commit is contained in:
2024-03-17 19:06:27 +01:00
parent 571d27c230
commit 924faca13f
3 changed files with 108 additions and 1 deletions

View File

@ -1,5 +1,6 @@
package ovh.herisson.Clyde.Repositories;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import ovh.herisson.Clyde.Tables.StorageFile;
@ -9,4 +10,7 @@ import java.util.ArrayList;
public interface FileRepository extends CrudRepository<StorageFile,Long> {
public StorageFile getStorageFileByName(String name);
@Query("select s from StorageFile s")
public ArrayList<StorageFile> findAll();
}

View File

@ -53,7 +53,7 @@ public class StorageService {
String url = this.rootLocation.resolve(Paths.get(Objects.requireNonNull(stringUuid)))
.normalize().toString();
return fileRepo.save(new StorageFile(file.getName(),url, fileType));
return fileRepo.save(new StorageFile(file.getOriginalFilename(),url, fileType));
}
public void delete(StorageFile file) throws SecurityException {