backend fixed Patch Research
This commit is contained in:
parent
3ea48c20aa
commit
47f1bffb24
@ -80,9 +80,10 @@ public class ResearcherController {
|
||||
|
||||
Researcher researcher = researchesServ.getResearcherById(id);
|
||||
if (authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin}, token)
|
||||
|| researcher == researchesServ.getResearcherByUser(authServ.getUserFromToken(token)))
|
||||
&& researcher.getId() != researchesServ.getResearcherByUser(authServ.getUserFromToken(token)).getId())
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
|
||||
if (researcher == null) return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
researchesServ.modifyResearcherData(researcher,updates);
|
||||
|
@ -83,18 +83,9 @@ public class ResearchesService {
|
||||
case "title":
|
||||
research.setTitle((String) entry.getValue());
|
||||
break;
|
||||
case "date":
|
||||
research.setReleaseDate((Date) entry.getValue());
|
||||
break;
|
||||
case "paperType":
|
||||
research.setPaperType((PaperType) entry.getValue());
|
||||
break;
|
||||
case "PdfLocation":
|
||||
research.setPdfLocation((String) entry.getValue());
|
||||
break;
|
||||
case "bibtexLocation":
|
||||
research.setBibTexLocation((String) entry.getValue());
|
||||
break;
|
||||
case "language":
|
||||
research.setLanguage((String) entry.getValue());
|
||||
break;
|
||||
@ -104,6 +95,9 @@ public class ResearchesService {
|
||||
case "summary":
|
||||
research.setSummary((String) entry.getValue());
|
||||
break;
|
||||
case "access":
|
||||
research.setAccess(Access.valueOf((String) entry.getValue()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
articleRepo.save(research);
|
||||
@ -175,12 +169,15 @@ public class ResearchesService {
|
||||
for (Map.Entry<String, Object> entry : updates.entrySet()){
|
||||
switch (entry.getKey()){
|
||||
case "orcidId":
|
||||
if (entry.getValue() != null)
|
||||
researcher.setOrcidId((String) entry.getValue());
|
||||
break;
|
||||
case "domain":
|
||||
if (entry.getValue() != null)
|
||||
researcher.setDomain((String) entry.getValue());
|
||||
break;
|
||||
case "site":
|
||||
if (entry.getValue() != null)
|
||||
researcher.setSite((String) entry.getValue());
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user