Skip to content
Snippets Groups Projects
Commit 244480d1 authored by Mirco Nasuti's avatar Mirco Nasuti
Browse files

bugfix data repositories

parent 0ade7af7
No related branches found
No related tags found
No related merge requests found
......@@ -57,7 +57,7 @@ public class AppsApi {
User user = mipApplication.getUser();
App app = appRepository.findOne(id);
Vote vote = voteRepository.find(user, app).iterator().next();
Vote vote = voteRepository.findByUserAndApp(user, app).iterator().next();
if (vote != null) {
vote.setValue(value);
......
......@@ -214,10 +214,10 @@ public class ExperimentApi {
User user = mipApplication.getUser();
Iterable<Experiment> experiments = null;
Iterable<Experiment> myExperiments = experimentRepository.findByUser(user);
Iterable<Experiment> myExperiments = experimentRepository.findByCreatedBy(user);
if(!mine)
{
Iterable<Experiment> sharedExperiments = experimentRepository.findShared(true);
Iterable<Experiment> sharedExperiments = experimentRepository.findByShared(true);
experiments = Iterables.concat(myExperiments, sharedExperiments);
}
......
......@@ -11,6 +11,6 @@ import java.util.UUID;
*/
public interface ExperimentRepository extends CrudRepository<Experiment, UUID> {
Iterable<Experiment> findByUser(User user);
Iterable<Experiment> findShared(Boolean shared);
Iterable<Experiment> findByCreatedBy(User user);
Iterable<Experiment> findByShared(Boolean shared);
}
......@@ -10,5 +10,5 @@ import org.springframework.data.repository.CrudRepository;
*/
public interface VoteRepository extends CrudRepository<Vote, Long> {
Iterable<Vote> find(User user, App app);
Iterable<Vote> findByUserAndApp(User user, App app);
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment