Add testing for file uploading and correct minors bugs in service
This commit is contained in:
		@ -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();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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 {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user