Works with native query now needst to be hql
This commit is contained in:
@ -34,7 +34,7 @@ public class ConfigController {
|
||||
private ConfiguratorService contrl;
|
||||
|
||||
@PostMapping("/config")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
// @PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
@ApiOperation("Imports data to system. To call you need to provide ADMIN token")
|
||||
public ResponseEntity<String> configApp(
|
||||
@RequestParam("file") @ApiParam(value = "file .xlsx that contains courses and groups with apoinnted rules") MultipartFile file) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.plannaplan.controllers;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.plannaplan.App;
|
||||
@ -40,6 +41,12 @@ public class GroupController {
|
||||
@RequestParam(name = "capacity", defaultValue = "true") @ApiParam(value = "Boolean if we want to have capacity field in response") Boolean capacity,
|
||||
@RequestParam(name = "takenPlaces", defaultValue = "false") @ApiParam(value = "Boolean if we want to have respoonse with information about taken places by other students") Boolean takenPlaces) {
|
||||
List<Groups> groups = this.groupService.getGroupsByCourse(id);
|
||||
HashMap<Groups, Integer> ammounts;
|
||||
|
||||
if (takenPlaces) {
|
||||
ammounts = this.groupService.getTakenPlaces(groups);
|
||||
}
|
||||
|
||||
if (capacity) {
|
||||
return new ResponseEntity<>(GroupsMappers.mapToGetCourseGroupsWithCapacityResponse(groups), HttpStatus.OK);
|
||||
}
|
||||
|
@ -20,8 +20,9 @@ public class GroupsMappers {
|
||||
return groups.stream().filter(Objects::nonNull).map(GroupWithCapacityResponse::new)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static CourseWithGroupsResponse<GroupDefaultResponse> mapToGetCourseGroupsDefaultResponse (List<Groups> groups){
|
||||
|
||||
public static CourseWithGroupsResponse<GroupDefaultResponse> mapToGetCourseGroupsDefaultResponse(
|
||||
List<Groups> groups) {
|
||||
|
||||
List<GroupDefaultResponse> lectures = new ArrayList<>();
|
||||
List<GroupDefaultResponse> classes = new ArrayList<>();
|
||||
@ -34,11 +35,11 @@ public class GroupsMappers {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return new CourseWithGroupsResponse<>(classes, lectures);
|
||||
}
|
||||
|
||||
public static CourseWithGroupsResponse<GroupWithCapacityResponse> mapToGetCourseGroupsWithCapacityResponse (List<Groups> groups){
|
||||
public static CourseWithGroupsResponse<GroupWithCapacityResponse> mapToGetCourseGroupsWithCapacityResponse(
|
||||
List<Groups> groups) {
|
||||
|
||||
List<GroupWithCapacityResponse> lectures = new ArrayList<>();
|
||||
List<GroupWithCapacityResponse> classes = new ArrayList<>();
|
||||
@ -51,7 +52,6 @@ public class GroupsMappers {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return new CourseWithGroupsResponse<>(classes, lectures);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user