Added api endpoiunt mapper needs to be rewriteen
This commit is contained in:
parent
b4bb13f2dd
commit
9d3500c1fb
@ -37,7 +37,8 @@ public class GroupController {
|
||||
@ApiOperation(value = "Return list of lectures and classes (if present) given course")
|
||||
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) {
|
||||
@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);
|
||||
if (capacity) {
|
||||
return new ResponseEntity<>(GroupsMappers.mapToGetCourseGroupsWithCapacityResponse(groups), HttpStatus.OK);
|
||||
|
@ -28,6 +28,9 @@ public class GroupDefaultResponse {
|
||||
@ApiModelProperty(value = "Value shows kind of group. The types are LECTURE or CLASS.")
|
||||
private GroupType type;
|
||||
|
||||
@ApiModelProperty(value = "Value shows how many places is already taken by other students.")
|
||||
private int takenPlaces;
|
||||
|
||||
public GroupDefaultResponse(Groups group) {
|
||||
this.id = group.getId() != null ? group.getId() : null;
|
||||
this.day = group.getDay() != null ? group.getDay().label : -1;
|
||||
@ -37,6 +40,11 @@ public class GroupDefaultResponse {
|
||||
this.type = group.getType() != null ? group.getType() : null;
|
||||
}
|
||||
|
||||
public GroupDefaultResponse(Groups group, int takenPlaces) {
|
||||
this(group);
|
||||
this.takenPlaces = takenPlaces;
|
||||
}
|
||||
|
||||
public GroupDefaultResponse(Assignment assignment) {
|
||||
this(assignment.getGroup());
|
||||
}
|
||||
@ -65,4 +73,8 @@ public class GroupDefaultResponse {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getTakenPlaces() {
|
||||
return this.takenPlaces;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,11 @@ public class GroupWithCapacityResponse extends GroupDefaultResponse {
|
||||
this.capacity = group.getCapacity();
|
||||
}
|
||||
|
||||
public GroupWithCapacityResponse(Groups group, int takenPlaces) {
|
||||
super(group, takenPlaces);
|
||||
this.capacity = group.getCapacity();
|
||||
}
|
||||
|
||||
public GroupWithCapacityResponse(Assignment assignment) {
|
||||
this(assignment.getGroup());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user