finish
All checks were successful
Build and test backend / Build-backend (pull_request) Successful in 1m25s
Build and test FrontEnd / Build-frontend (pull_request) Successful in 24s

This commit is contained in:
2024-04-21 09:46:46 +02:00
parent ecaf5e3df8
commit 0621c6fe68
7 changed files with 31 additions and 90 deletions

View File

@ -13,6 +13,7 @@ import ovh.herisson.Clyde.Tables.UserCurriculum;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@ -149,13 +150,13 @@ public class CourseController {
//Get all the courses followed by an user
@GetMapping("/usercourses/{userId}")
public ResponseEntity<ArrayList<Course>> getAllUserCourses(@PathVariable long userId){
User u = userService.getUserById(userId);
@GetMapping("/usercourses")
public ResponseEntity<List<Course>> getAllUserCourses(@RequestHeader("Authorization") String token){
User u = authServ.getUserFromToken(token);
//We get all the actual curriculums of the user
ArrayList<UserCurriculum> userCurricula = userCurriculumService.findByStudentAndActual(u, true);
ArrayList<Course> toReturn = new ArrayList<>();
List<UserCurriculum> userCurricula = userCurriculumService.findByStudentAndActual(u, true);
List<Course> toReturn = new ArrayList<>();
//We iterate through all the curriculums and we extract the courses
for (int i = 0; i < userCurricula.size(); i++){

View File

@ -110,7 +110,4 @@ public class ForumController {
forumServ.answerTopic(t, data, u);
return new ResponseEntity<>(HttpStatus.ACCEPTED);
}
// TODO: <tonitch> Check if authorization to view a post/forum/...
}