autogenerate query

This commit is contained in:
F43nd1r 2017-06-21 14:48:41 +02:00
parent acfa55fccf
commit 1e24d9cce8
2 changed files with 3 additions and 7 deletions

View file

@ -101,16 +101,15 @@ public class DataManager {
}
public List<ProguardMapping> getMappings(String app) {
return mappingRepository.findByApp(app);
return mappingRepository.findAllByIdApp(app);
}
public void newReport(String app, JSONObject content) {
newReport(app, content, Collections.emptyList());
}
@SuppressWarnings("UnusedReturnValue")
@CacheEvict(value = APP_REPORT_CACHE, key = "#a0")
public synchronized ReportInfo newReport(String app, JSONObject content, List<MultipartFile> attachments) {
public synchronized void newReport(String app, JSONObject content, List<MultipartFile> attachments) {
Report report = reportRepository.save(new Report(content, app));
for (MultipartFile a : attachments) {
try {
@ -124,7 +123,6 @@ public class DataManager {
Bug bug = getBugs(app).stream().filter(b -> matches(b, info)).findAny().orElseGet(() -> new Bug(info.getApp(), info.getStacktrace(), info.getVersionCode()));
bug.getReportIds().add(info.getId());
saveBug(bug);
return info;
}
@Cacheable(APP_REPORT_CACHE)

View file

@ -2,7 +2,6 @@ package com.faendir.acra.mongod.data;
import com.faendir.acra.mongod.model.ProguardMapping;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import java.util.List;
@ -11,6 +10,5 @@ import java.util.List;
* @since 19.05.2017
*/
interface MappingRepository extends MongoRepository<ProguardMapping, ProguardMapping.MetaData> {
@Query("{id.app:?0}")
List<ProguardMapping> findByApp(String app);
List<ProguardMapping> findAllByIdApp(String app);
}