1
0
forked from PGL/Clyde

cleaned the services

This commit is contained in:
2024-03-16 20:25:35 +01:00
parent 97b57b361d
commit 382d3c203a
16 changed files with 67 additions and 87 deletions

View File

@@ -46,7 +46,7 @@ public class CourseController {
@RequestBody Course course)
{
if (authServ.IsNotIn(new Role[]{Role.Secretary,Role.Admin},token))
if (authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token))
return new UnauthorizedResponse<>(null);
return new ResponseEntity<>(courseServ.save(course), HttpStatus.CREATED);
@@ -59,15 +59,15 @@ public class CourseController {
@PathVariable long id)
{
if (authServ.IsNotIn(new Role[]{Role.Admin,Role.Teacher,Role.Secretary}, token))
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Teacher,Role.Secretary}, token))
return new UnauthorizedResponse<>(null);
Course modifiedCourse = courseServ.modifyData(id,updates,authServ.getUserFromToken(token).getRole());
if (modifiedCourse == null)
if (!courseServ.modifyData(id, updates, authServ.getUserFromToken(token).getRole()))
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
return new ResponseEntity<>(modifiedCourse, HttpStatus.OK);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/course/{id}")
@@ -76,7 +76,7 @@ public class CourseController {
@PathVariable Long id)
{
if (authServ.IsNotIn(new Role[]{Role.Admin,Role.Secretary}, token))
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary}, token))
return new UnauthorizedResponse<>(null);