Part 2 has been ended. The Part 3: chanaged test
This commit is contained in:
@ -16,7 +16,7 @@ import com.plannaplan.entities.Assignment;
|
||||
import com.plannaplan.entities.Commision;
|
||||
import com.plannaplan.entities.User;
|
||||
import com.plannaplan.responses.mappers.AssignmentResponseMappers;
|
||||
import com.plannaplan.responses.models.GetCurrentAssignmentsResponse;
|
||||
import com.plannaplan.responses.models.AssignmentResponse;
|
||||
import com.plannaplan.services.AssignmentService;
|
||||
import com.plannaplan.services.CommisionService;
|
||||
|
||||
@ -40,7 +40,7 @@ public class AssignmentsController extends TokenBasedController {
|
||||
|
||||
@GetMapping("/user")
|
||||
@ApiOperation(value = "Return user current assignemts (from newest commision). STUDENT Token needs to be provided.")
|
||||
public ResponseEntity<List<GetCurrentAssignmentsResponse>> getCurrentAssignments() throws Exception {
|
||||
public ResponseEntity<List<AssignmentResponse>> getCurrentAssignments() throws Exception {
|
||||
User user = this.getCurrentUser().orElseThrow(() -> new NullPointerException("User not found"));
|
||||
Optional<Commision> com = this.commisionService.getNewestCommision(user);
|
||||
|
||||
|
@ -5,8 +5,8 @@ import java.util.List;
|
||||
import com.plannaplan.App;
|
||||
import com.plannaplan.entities.Course;
|
||||
import com.plannaplan.responses.mappers.CoursesResponseMappers;
|
||||
import com.plannaplan.responses.models.GetCoursesResponse;
|
||||
import com.plannaplan.responses.models.GetCoursesWithGroupsResponse;
|
||||
import com.plannaplan.responses.models.CoursesDefaultResponse;
|
||||
import com.plannaplan.responses.models.CoursesWithGroupsResponse;
|
||||
import com.plannaplan.services.CourseService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -39,11 +39,11 @@ public class CoursesController {
|
||||
@RequestParam(name = "groups", defaultValue = "false") @ApiParam(value = "Boolean if you want to have resopnse with associated groups or without") Boolean groups) {
|
||||
List<Course> courses = this.courseService.getAllCourses();
|
||||
if (groups) {
|
||||
final List<GetCoursesWithGroupsResponse> response = CoursesResponseMappers
|
||||
final List<CoursesWithGroupsResponse> response = CoursesResponseMappers
|
||||
.mapToGetCoursesWithGroupsResponse(courses);
|
||||
return new ResponseEntity<>(response, HttpStatus.OK);
|
||||
}
|
||||
final List<GetCoursesResponse> response = CoursesResponseMappers.mapToGetCoursesResponse(courses);
|
||||
final List<CoursesDefaultResponse> response = CoursesResponseMappers.mapToGetCoursesResponse(courses);
|
||||
return new ResponseEntity<>(response, HttpStatus.OK);
|
||||
}
|
||||
}
|
@ -5,8 +5,8 @@ import java.util.List;
|
||||
import com.plannaplan.App;
|
||||
import com.plannaplan.entities.Groups;
|
||||
import com.plannaplan.responses.mappers.GroupsMappers;
|
||||
import com.plannaplan.responses.models.DefaultGroupResponse;
|
||||
import com.plannaplan.responses.models.GetCourseGroupsResponse;
|
||||
import com.plannaplan.responses.models.GroupDefaultResponse;
|
||||
import com.plannaplan.responses.models.CourseWithGroupsResponse;
|
||||
import com.plannaplan.services.GroupService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -35,7 +35,7 @@ public class GroupController {
|
||||
|
||||
@GetMapping("/course/{id}")
|
||||
@ApiOperation(value = "Return list of lectures and classes (if present) given course")
|
||||
public ResponseEntity<GetCourseGroupsResponse<? extends DefaultGroupResponse>> getCourses(
|
||||
public ResponseEntity<CourseWithGroupsResponse<? extends GroupDefaultResponse>> getCourses(
|
||||
@PathVariable(name = "id") Long id,
|
||||
@RequestParam(name = "capacity", defaultValue = "true") @ApiParam(value = "Boolean if we want to have capacity field in response") Boolean capacity) {
|
||||
List<Groups> groups = this.groupService.getGroupsByCourse(id);
|
||||
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||
import com.plannaplan.App;
|
||||
import com.plannaplan.entities.User;
|
||||
import com.plannaplan.responses.mappers.UserResponseMappers;
|
||||
import com.plannaplan.responses.models.SearchForStudentsResponse;
|
||||
import com.plannaplan.responses.models.UserResponse;
|
||||
import com.plannaplan.services.UserService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -36,10 +36,10 @@ public class UsersController {
|
||||
@GetMapping("/student/search")
|
||||
@PreAuthorize("hasRole('ROLE_DEANERY')")
|
||||
@ApiOperation(value = "Serch for user by providing query. If query is empty it will return all students. You need token with DEANERY role to call this")
|
||||
public ResponseEntity<List<SearchForStudentsResponse>> configApp(
|
||||
public ResponseEntity<List<UserResponse>> configApp(
|
||||
@RequestParam("query") @ApiParam(value = "Query to filter all students. If empty will match everyone") String query) {
|
||||
final List<User> searches = this.userService.searchForStudents(query);
|
||||
final List<SearchForStudentsResponse> response = UserResponseMappers.mapToDefaultResponse(searches);
|
||||
final List<UserResponse> response = UserResponseMappers.mapToDefaultResponse(searches);
|
||||
return new ResponseEntity<>(response, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user