fixed POST addview
This commit is contained in:
		| @ -229,10 +229,11 @@ public class ResearchController { | ||||
|  | ||||
|     /////// | ||||
|     //views part | ||||
|     @PostMapping("/addview/{url}") | ||||
|     @PostMapping("/addview/cdn/{url}") | ||||
|     public ResponseEntity<ResearchDTO> addView(@PathVariable String url){ | ||||
|         Research research = researchesServ.getResearchByUrl(url); | ||||
|         if (research ==null) return new ResponseEntity<>(HttpStatus.NOT_FOUND); | ||||
|         System.out.println(url); | ||||
|         Research research = researchesServ.getResearchByUrl("cdn/" + url); | ||||
|         if (research ==null) return new ResponseEntity<>(HttpStatus.BAD_REQUEST); | ||||
|  | ||||
|         return new ResponseEntity<>(ResearchDTO.construct(researchesServ.addView(research)), HttpStatus.OK); | ||||
|     } | ||||
|  | ||||
| @ -1,5 +1,6 @@ | ||||
| package ovh.herisson.Clyde.Repositories.ScientificPublications; | ||||
|  | ||||
| import org.springframework.data.jpa.repository.Query; | ||||
| import org.springframework.data.repository.CrudRepository; | ||||
| import ovh.herisson.Clyde.Tables.ScientificPublications.Research; | ||||
| import ovh.herisson.Clyde.Tables.ScientificPublications.Researcher; | ||||
| @ -12,6 +13,7 @@ public interface ResearchRepository extends CrudRepository<Research,Long> { | ||||
|  | ||||
|     Iterable<Research> findByAuthor(Researcher author); | ||||
|  | ||||
|     @Query("select r from Research r where r.pdfLocation = ?1") | ||||
|     Research findByPdfLocation(String url); | ||||
|  | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user