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
@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);
}

View File

@ -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);
}

View File

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