1
0
forked from PGL/Clyde

fixed POST addview

This commit is contained in:
Bartha Maxime 2024-04-19 17:37:59 +02:00
parent e998fb2ab4
commit be7f42aafe
3 changed files with 7 additions and 3 deletions

View File

@ -229,10 +229,11 @@ public class ResearchController {
/////// ///////
//views part //views part
@PostMapping("/addview/{url}") @PostMapping("/addview/cdn/{url}")
public ResponseEntity<ResearchDTO> addView(@PathVariable String url){ public ResponseEntity<ResearchDTO> addView(@PathVariable String url){
Research research = researchesServ.getResearchByUrl(url); System.out.println(url);
if (research ==null) return new ResponseEntity<>(HttpStatus.NOT_FOUND); 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); return new ResponseEntity<>(ResearchDTO.construct(researchesServ.addView(research)), HttpStatus.OK);
} }

View File

@ -1,5 +1,6 @@
package ovh.herisson.Clyde.Repositories.ScientificPublications; package ovh.herisson.Clyde.Repositories.ScientificPublications;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import ovh.herisson.Clyde.Tables.ScientificPublications.Research; import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
import ovh.herisson.Clyde.Tables.ScientificPublications.Researcher; import ovh.herisson.Clyde.Tables.ScientificPublications.Researcher;
@ -12,6 +13,7 @@ public interface ResearchRepository extends CrudRepository<Research,Long> {
Iterable<Research> findByAuthor(Researcher author); Iterable<Research> findByAuthor(Researcher author);
@Query("select r from Research r where r.pdfLocation = ?1")
Research findByPdfLocation(String url); Research findByPdfLocation(String url);
} }

View File

@ -62,6 +62,7 @@ function downloadBibTex(){
async function articleClicked(){ async function articleClicked(){
await addView(props.article.pdfLocation) await addView(props.article.pdfLocation)
emit('modal-close') emit('modal-close')
emit('modified')
} }
/** /**