Compare commits

..

3 Commits

Author SHA1 Message Date
385290d1a2 Merge branch 'master' into Max/Backend/ReturnUserPasswordIssue
All checks were successful
Build and test backend / Build-backend (pull_request) Successful in 2m4s
Build and test backend / Test-backend (pull_request) Successful in 1m58s
Build and test FrontEnd / Build-frontend (pull_request) Successful in 24s
2024-03-17 13:07:20 +01:00
dcec45acf5 Merge pull request 'added /students endpoint' (#135) from Max/Backend/StudentEndPoin into master
All checks were successful
Build and test backend / Build-backend (push) Successful in 2m11s
Build and test backend / Test-backend (push) Successful in 1m19s
deploy to production / deploy-frontend (push) Successful in 24s
deploy to production / deploy-backend (push) Successful in 2m20s
Build and test FrontEnd / Build-frontend (push) Successful in 24s
Reviewed-on: #135
Reviewed-by: Debucquoy Anthony <d.tonitch@gmail.com>
Reviewed-by: Wal <karpinskiwal@gmail.com>
2024-03-17 12:00:57 +01:00
4379794dba added /students endpoint
All checks were successful
Build and test backend / Build-backend (pull_request) Successful in 2m1s
Build and test backend / Test-backend (pull_request) Successful in 1m56s
Build and test FrontEnd / Build-frontend (pull_request) Successful in 23s
2024-03-16 23:05:26 +01:00
3 changed files with 16 additions and 3 deletions

View File

@ -83,7 +83,6 @@ public class UserController {
@GetMapping("/teachers")
public ResponseEntity<Iterable<HashMap<String,Object>>> getAllTeachers(@RequestHeader("Authorization") String token){
if (authServ.getUserFromToken(token) == null)
return new UnauthorizedResponse<>(null);
@ -91,5 +90,15 @@ public class UserController {
return new ResponseEntity<>(ProtectionService.usersWithoutPasswords(teachers), HttpStatus.OK);
}
}
@GetMapping("/students")
public ResponseEntity<Iterable<HashMap<String,Object>>> getAllStudent(@RequestHeader("Authorization") String token){
if (authServ.getUserFromToken(token) == null)
return new UnauthorizedResponse<>(null);
Iterable<User> students = userService.getAllStudents();
return new ResponseEntity<>(ProtectionService.usersWithoutPasswords(students), HttpStatus.OK);
}
}

View File

@ -12,4 +12,7 @@ public interface UserRepository extends CrudRepository<User, Long> {
@Query("select u from User u where u.role = ovh.herisson.Clyde.Tables.Role.Teacher")
Iterable<User> findAllTeachers();
@Query("select u from User u where u.role = ovh.herisson.Clyde.Tables.Role.Student")
Iterable<User> findAllStudents();
}

View File

@ -115,6 +115,7 @@ public class UserService {
}
public Iterable<User> getAllTeachers (){return userRepo.findAllTeachers();}
public Iterable<User> getAllStudents(){return userRepo.findAllStudents();}
}