finish
This commit is contained in:
@ -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++){
|
||||
|
@ -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/...
|
||||
}
|
||||
|
Reference in New Issue
Block a user