Added api endpoiunt mapper needs to be rewriteen

This commit is contained in:
BuildTools
2020-11-20 16:20:38 +01:00
parent b4bb13f2dd
commit 9d3500c1fb
3 changed files with 19 additions and 1 deletions

View File

@ -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;
}
}

View File

@ -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());
}