new_model_for_communities #15
|
@ -221,6 +221,22 @@ public class CommunityApiController extends AbstractDnetController {
|
|||
communityService.removeCommunityProjects(id, projectIdList);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/{id}/funders", produces = {
|
||||
"application/json"
|
||||
}, method = RequestMethod.GET)
|
||||
@Operation(summary = "get the funders of the projects of a community", description = "get the funders of the projects of a community", tags = {
|
||||
C_PJ, R
|
||||
})
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "not found"),
|
||||
@ApiResponse(responseCode = "500", description = "unexpected error")
|
||||
})
|
||||
public List<String> getCommunityFunders(@PathVariable final String id)
|
||||
throws CommunityException {
|
||||
return communityService.getCommunityFunders(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/community/{id}/contentproviders", produces = {
|
||||
"application/json"
|
||||
}, method = RequestMethod.GET)
|
||||
|
|
|
@ -612,4 +612,9 @@ public class CommunityService {
|
|||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public List<String> getCommunityFunders(final String id) {
|
||||
return dbProjectRepository.findFundersByCommunity(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package eu.dnetlib.openaire.community.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import eu.dnetlib.openaire.community.model.DbProject;
|
||||
import eu.dnetlib.openaire.community.model.DbProjectPK;
|
||||
|
@ -16,4 +19,7 @@ public interface DbProjectRepository extends JpaRepository<DbProject, DbProjectP
|
|||
|
||||
void deleteByCommunity(String id);
|
||||
|
||||
@Query(value = "select distinct project_funder from community_projects where community = ?1 order by project_funder", nativeQuery = true)
|
||||
List<String> findFundersByCommunity(String id);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue