From 035de011f2e65e35605f22e6bc79dc099b85e950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Sun, 8 Nov 2020 17:20:00 +0100 Subject: [PATCH] Part 2 has been ended. The Part 3: chanaged test --- .../controllers/AssignmentsController.java | 4 +- .../controllers/CoursesController.java | 8 ++-- .../controllers/GroupController.java | 6 +-- .../controllers/UsersController.java | 6 +-- .../mappers/AssignmentResponseMappers.java | 10 ++--- .../mappers/CoursesResponseMappers.java | 12 +++--- .../responses/mappers/GroupsMappers.java | 38 +++++++++---------- .../mappers/UserResponseMappers.java | 6 +-- ...sResponse.java => AssignmentResponse.java} | 20 +++++----- .../responses/models/CommisionResponse.java | 2 +- ...nse.java => CourseWithGroupsResponse.java} | 6 +-- ...ponse.java => CoursesDefaultResponse.java} | 6 +-- ...se.java => CoursesWithGroupsResponse.java} | 18 ++++----- ...esponse.java => GroupDefaultResponse.java} | 8 ++-- ...se.java => GroupWithCapacityResponse.java} | 8 ++-- ...tudentsResponse.java => UserResponse.java} | 6 +-- 16 files changed, 82 insertions(+), 82 deletions(-) rename restservice/src/main/java/com/plannaplan/responses/models/{GetCurrentAssignmentsResponse.java => AssignmentResponse.java} (53%) rename restservice/src/main/java/com/plannaplan/responses/models/{GetCourseGroupsResponse.java => CourseWithGroupsResponse.java} (72%) rename restservice/src/main/java/com/plannaplan/responses/models/{GetCoursesResponse.java => CoursesDefaultResponse.java} (65%) rename restservice/src/main/java/com/plannaplan/responses/models/{GetCoursesWithGroupsResponse.java => CoursesWithGroupsResponse.java} (53%) rename restservice/src/main/java/com/plannaplan/responses/models/{DefaultGroupResponse.java => GroupDefaultResponse.java} (90%) rename restservice/src/main/java/com/plannaplan/responses/models/{WithCapacityGroupResponse.java => GroupWithCapacityResponse.java} (64%) rename restservice/src/main/java/com/plannaplan/responses/models/{SearchForStudentsResponse.java => UserResponse.java} (83%) diff --git a/restservice/src/main/java/com/plannaplan/controllers/AssignmentsController.java b/restservice/src/main/java/com/plannaplan/controllers/AssignmentsController.java index 7db4726..2f07c2a 100755 --- a/restservice/src/main/java/com/plannaplan/controllers/AssignmentsController.java +++ b/restservice/src/main/java/com/plannaplan/controllers/AssignmentsController.java @@ -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> getCurrentAssignments() throws Exception { + public ResponseEntity> getCurrentAssignments() throws Exception { User user = this.getCurrentUser().orElseThrow(() -> new NullPointerException("User not found")); Optional com = this.commisionService.getNewestCommision(user); diff --git a/restservice/src/main/java/com/plannaplan/controllers/CoursesController.java b/restservice/src/main/java/com/plannaplan/controllers/CoursesController.java index f6ef2c5..5e9243d 100755 --- a/restservice/src/main/java/com/plannaplan/controllers/CoursesController.java +++ b/restservice/src/main/java/com/plannaplan/controllers/CoursesController.java @@ -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 courses = this.courseService.getAllCourses(); if (groups) { - final List response = CoursesResponseMappers + final List response = CoursesResponseMappers .mapToGetCoursesWithGroupsResponse(courses); return new ResponseEntity<>(response, HttpStatus.OK); } - final List response = CoursesResponseMappers.mapToGetCoursesResponse(courses); + final List response = CoursesResponseMappers.mapToGetCoursesResponse(courses); return new ResponseEntity<>(response, HttpStatus.OK); } } \ No newline at end of file diff --git a/restservice/src/main/java/com/plannaplan/controllers/GroupController.java b/restservice/src/main/java/com/plannaplan/controllers/GroupController.java index 811f43a..65b6c4e 100755 --- a/restservice/src/main/java/com/plannaplan/controllers/GroupController.java +++ b/restservice/src/main/java/com/plannaplan/controllers/GroupController.java @@ -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> getCourses( + public ResponseEntity> 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 = this.groupService.getGroupsByCourse(id); diff --git a/restservice/src/main/java/com/plannaplan/controllers/UsersController.java b/restservice/src/main/java/com/plannaplan/controllers/UsersController.java index 4cbe585..f662260 100755 --- a/restservice/src/main/java/com/plannaplan/controllers/UsersController.java +++ b/restservice/src/main/java/com/plannaplan/controllers/UsersController.java @@ -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> configApp( + public ResponseEntity> configApp( @RequestParam("query") @ApiParam(value = "Query to filter all students. If empty will match everyone") String query) { final List searches = this.userService.searchForStudents(query); - final List response = UserResponseMappers.mapToDefaultResponse(searches); + final List response = UserResponseMappers.mapToDefaultResponse(searches); return new ResponseEntity<>(response, HttpStatus.OK); } } diff --git a/restservice/src/main/java/com/plannaplan/responses/mappers/AssignmentResponseMappers.java b/restservice/src/main/java/com/plannaplan/responses/mappers/AssignmentResponseMappers.java index b82bd7a..8ce1745 100755 --- a/restservice/src/main/java/com/plannaplan/responses/mappers/AssignmentResponseMappers.java +++ b/restservice/src/main/java/com/plannaplan/responses/mappers/AssignmentResponseMappers.java @@ -8,13 +8,13 @@ import java.util.Map; import com.plannaplan.entities.Assignment; import com.plannaplan.entities.Course; import com.plannaplan.entities.Groups; -import com.plannaplan.responses.models.GetCurrentAssignmentsResponse; +import com.plannaplan.responses.models.AssignmentResponse; import com.plannaplan.types.GroupType; public class AssignmentResponseMappers { - public static final List mapToResponse(List assignments) { - List response = new ArrayList<>(); + public static final List mapToResponse(List assignments) { + List response = new ArrayList<>(); HashMap> courses = new HashMap<>(); assignments.stream().forEach((Assignment assignment) -> { final Groups group = assignment.getGroup(); @@ -29,14 +29,14 @@ public class AssignmentResponseMappers { final Course course = entry.getKey(); final List courseGroups = entry.getValue(); if (courseGroups.size() == 1) { - response.add(new GetCurrentAssignmentsResponse(course, courseGroups.get(0))); + response.add(new AssignmentResponse(course, courseGroups.get(0))); } if (courseGroups.size() == 2) { final Groups lecture = courseGroups.stream().filter(o -> o.getType() == GroupType.LECTURE).findFirst() .get(); final Groups classes = courseGroups.stream().filter(o -> o.getType() == GroupType.CLASS).findFirst() .get(); - response.add(new GetCurrentAssignmentsResponse(course, lecture, classes)); + response.add(new AssignmentResponse(course, lecture, classes)); } } diff --git a/restservice/src/main/java/com/plannaplan/responses/mappers/CoursesResponseMappers.java b/restservice/src/main/java/com/plannaplan/responses/mappers/CoursesResponseMappers.java index 24958c5..5d9c1df 100755 --- a/restservice/src/main/java/com/plannaplan/responses/mappers/CoursesResponseMappers.java +++ b/restservice/src/main/java/com/plannaplan/responses/mappers/CoursesResponseMappers.java @@ -5,16 +5,16 @@ import java.util.Objects; import java.util.stream.Collectors; import com.plannaplan.entities.Course; -import com.plannaplan.responses.models.GetCoursesResponse; -import com.plannaplan.responses.models.GetCoursesWithGroupsResponse; +import com.plannaplan.responses.models.CoursesDefaultResponse; +import com.plannaplan.responses.models.CoursesWithGroupsResponse; public class CoursesResponseMappers { - public static final List mapToGetCoursesResponse(List courses) { - return courses.stream().filter(Objects::nonNull).map(GetCoursesResponse::new).collect(Collectors.toList()); + public static final List mapToGetCoursesResponse(List courses) { + return courses.stream().filter(Objects::nonNull).map(CoursesDefaultResponse::new).collect(Collectors.toList()); } - public static final List mapToGetCoursesWithGroupsResponse(List courses) { - return courses.stream().filter(Objects::nonNull).map(GetCoursesWithGroupsResponse::new) + public static final List mapToGetCoursesWithGroupsResponse(List courses) { + return courses.stream().filter(Objects::nonNull).map(CoursesWithGroupsResponse::new) .collect(Collectors.toList()); } } diff --git a/restservice/src/main/java/com/plannaplan/responses/mappers/GroupsMappers.java b/restservice/src/main/java/com/plannaplan/responses/mappers/GroupsMappers.java index 401a5a1..8fa6c0f 100755 --- a/restservice/src/main/java/com/plannaplan/responses/mappers/GroupsMappers.java +++ b/restservice/src/main/java/com/plannaplan/responses/mappers/GroupsMappers.java @@ -6,53 +6,53 @@ import java.util.Objects; import java.util.stream.Collectors; import com.plannaplan.entities.Groups; -import com.plannaplan.responses.models.DefaultGroupResponse; -import com.plannaplan.responses.models.GetCourseGroupsResponse; -import com.plannaplan.responses.models.WithCapacityGroupResponse; +import com.plannaplan.responses.models.GroupDefaultResponse; +import com.plannaplan.responses.models.CourseWithGroupsResponse; +import com.plannaplan.responses.models.GroupWithCapacityResponse; import com.plannaplan.types.GroupType; public class GroupsMappers { - public static List mapToDefaultResponse(List groups) { - return groups.stream().filter(Objects::nonNull).map(DefaultGroupResponse::new).collect(Collectors.toList()); + public static List mapToDefaultResponse(List groups) { + return groups.stream().filter(Objects::nonNull).map(GroupDefaultResponse::new).collect(Collectors.toList()); } - public static List mapToCapacityResponse(List groups) { - return groups.stream().filter(Objects::nonNull).map(WithCapacityGroupResponse::new) + public static List mapToCapacityResponse(List groups) { + return groups.stream().filter(Objects::nonNull).map(GroupWithCapacityResponse::new) .collect(Collectors.toList()); } - public static GetCourseGroupsResponse mapToGetCourseGroupsDefaultResponse (List groups){ + public static CourseWithGroupsResponse mapToGetCourseGroupsDefaultResponse (List groups){ - List lectures = new ArrayList<>(); - List classes = new ArrayList<>(); + List lectures = new ArrayList<>(); + List classes = new ArrayList<>(); groups.stream().forEach(group -> { if (group.getType() == GroupType.CLASS) { - classes.add(new DefaultGroupResponse(group)); + classes.add(new GroupDefaultResponse(group)); } else { - lectures.add(new DefaultGroupResponse(group)); + lectures.add(new GroupDefaultResponse(group)); } }); - return new GetCourseGroupsResponse<>(classes, lectures); + return new CourseWithGroupsResponse<>(classes, lectures); } - public static GetCourseGroupsResponse mapToGetCourseGroupsWithCapacityResponse (List groups){ + public static CourseWithGroupsResponse mapToGetCourseGroupsWithCapacityResponse (List groups){ - List lectures = new ArrayList<>(); - List classes = new ArrayList<>(); + List lectures = new ArrayList<>(); + List classes = new ArrayList<>(); groups.stream().forEach(group -> { if (group.getType() == GroupType.CLASS) { - classes.add(new WithCapacityGroupResponse(group)); + classes.add(new GroupWithCapacityResponse(group)); } else { - lectures.add(new WithCapacityGroupResponse(group)); + lectures.add(new GroupWithCapacityResponse(group)); } }); - return new GetCourseGroupsResponse<>(classes, lectures); + return new CourseWithGroupsResponse<>(classes, lectures); } } diff --git a/restservice/src/main/java/com/plannaplan/responses/mappers/UserResponseMappers.java b/restservice/src/main/java/com/plannaplan/responses/mappers/UserResponseMappers.java index f039341..096b20e 100755 --- a/restservice/src/main/java/com/plannaplan/responses/mappers/UserResponseMappers.java +++ b/restservice/src/main/java/com/plannaplan/responses/mappers/UserResponseMappers.java @@ -5,11 +5,11 @@ import java.util.Objects; import java.util.stream.Collectors; import com.plannaplan.entities.User; -import com.plannaplan.responses.models.SearchForStudentsResponse; +import com.plannaplan.responses.models.UserResponse; public class UserResponseMappers { - public static List mapToDefaultResponse(List groups) { - return groups.stream().filter(Objects::nonNull).map(SearchForStudentsResponse::new) + public static List mapToDefaultResponse(List groups) { + return groups.stream().filter(Objects::nonNull).map(UserResponse::new) .collect(Collectors.toList()); } } diff --git a/restservice/src/main/java/com/plannaplan/responses/models/GetCurrentAssignmentsResponse.java b/restservice/src/main/java/com/plannaplan/responses/models/AssignmentResponse.java similarity index 53% rename from restservice/src/main/java/com/plannaplan/responses/models/GetCurrentAssignmentsResponse.java rename to restservice/src/main/java/com/plannaplan/responses/models/AssignmentResponse.java index 416e61f..e78b55d 100755 --- a/restservice/src/main/java/com/plannaplan/responses/models/GetCurrentAssignmentsResponse.java +++ b/restservice/src/main/java/com/plannaplan/responses/models/AssignmentResponse.java @@ -6,30 +6,30 @@ import com.plannaplan.types.GroupType; import io.swagger.annotations.ApiModel; -@ApiModel(description = "Response shows information about given assigment to course.", value = "GetCurrentAssignmentsResponse") -public class GetCurrentAssignmentsResponse { +@ApiModel(description = "Response shows information about given assigment to course.", value = "AssignmentResponse") +public class AssignmentResponse { private Long id; private String name; - private WithCapacityGroupResponse classes; - private WithCapacityGroupResponse lecture; + private GroupWithCapacityResponse classes; + private GroupWithCapacityResponse lecture; - public GetCurrentAssignmentsResponse(Course course, Groups lecture, Groups classes) { + public AssignmentResponse(Course course, Groups lecture, Groups classes) { this.id = course.getId(); this.name = course.getName(); - this.lecture = lecture == null ? null : new WithCapacityGroupResponse(lecture); - this.classes = classes == null ? null : new WithCapacityGroupResponse(classes); + this.lecture = lecture == null ? null : new GroupWithCapacityResponse(lecture); + this.classes = classes == null ? null : new GroupWithCapacityResponse(classes); } - public GetCurrentAssignmentsResponse(Course course, Groups group) { + public AssignmentResponse(Course course, Groups group) { this(course, group.getType() == GroupType.LECTURE ? group : null, group.getType() == GroupType.CLASS ? group : null); } - public WithCapacityGroupResponse getLecture() { + public GroupWithCapacityResponse getLecture() { return this.lecture; } - public WithCapacityGroupResponse getClasses() { + public GroupWithCapacityResponse getClasses() { return this.classes; } diff --git a/restservice/src/main/java/com/plannaplan/responses/models/CommisionResponse.java b/restservice/src/main/java/com/plannaplan/responses/models/CommisionResponse.java index 29e04b4..63df94d 100755 --- a/restservice/src/main/java/com/plannaplan/responses/models/CommisionResponse.java +++ b/restservice/src/main/java/com/plannaplan/responses/models/CommisionResponse.java @@ -7,7 +7,7 @@ import com.plannaplan.entities.Commision; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -@ApiModel(description = "Response shows information about commision", value = "CommisionResponse") +@ApiModel(description = "Response shows information about commision.", value = "CommisionResponse") public class CommisionResponse { @ApiModelProperty(value = "ID created by database") private Long id; diff --git a/restservice/src/main/java/com/plannaplan/responses/models/GetCourseGroupsResponse.java b/restservice/src/main/java/com/plannaplan/responses/models/CourseWithGroupsResponse.java similarity index 72% rename from restservice/src/main/java/com/plannaplan/responses/models/GetCourseGroupsResponse.java rename to restservice/src/main/java/com/plannaplan/responses/models/CourseWithGroupsResponse.java index f2bcc45..6b8107f 100755 --- a/restservice/src/main/java/com/plannaplan/responses/models/GetCourseGroupsResponse.java +++ b/restservice/src/main/java/com/plannaplan/responses/models/CourseWithGroupsResponse.java @@ -5,13 +5,13 @@ import java.util.List; import io.swagger.annotations.ApiModel; -@ApiModel(description = "Response shows information about groups to given course.", value = "DefaultGroupResponse") -public class GetCourseGroupsResponse { +@ApiModel(description = "Response shows information about groups to given course.", value = "CourseWithGroupsResponse") +public class CourseWithGroupsResponse { private List lectures = new ArrayList<>(); private List classes = new ArrayList<>(); - public GetCourseGroupsResponse(List classes, List lectures ){ + public CourseWithGroupsResponse(List classes, List lectures ){ this.lectures = lectures; this.classes = classes; } diff --git a/restservice/src/main/java/com/plannaplan/responses/models/GetCoursesResponse.java b/restservice/src/main/java/com/plannaplan/responses/models/CoursesDefaultResponse.java similarity index 65% rename from restservice/src/main/java/com/plannaplan/responses/models/GetCoursesResponse.java rename to restservice/src/main/java/com/plannaplan/responses/models/CoursesDefaultResponse.java index c76157f..12f5671 100755 --- a/restservice/src/main/java/com/plannaplan/responses/models/GetCoursesResponse.java +++ b/restservice/src/main/java/com/plannaplan/responses/models/CoursesDefaultResponse.java @@ -5,10 +5,10 @@ import com.plannaplan.responses.models.abstracts.CoursesResponse; import io.swagger.annotations.ApiModel; -@ApiModel(description = "Response shows information about course.", value = "DefaultGroupResponse") -public class GetCoursesResponse extends CoursesResponse { +@ApiModel(description = "Response shows information about course.", value = "CoursesDefaultResponse") +public class CoursesDefaultResponse extends CoursesResponse { - public GetCoursesResponse(Course course) { + public CoursesDefaultResponse(Course course) { super(course); } diff --git a/restservice/src/main/java/com/plannaplan/responses/models/GetCoursesWithGroupsResponse.java b/restservice/src/main/java/com/plannaplan/responses/models/CoursesWithGroupsResponse.java similarity index 53% rename from restservice/src/main/java/com/plannaplan/responses/models/GetCoursesWithGroupsResponse.java rename to restservice/src/main/java/com/plannaplan/responses/models/CoursesWithGroupsResponse.java index 0dd2d49..188565a 100755 --- a/restservice/src/main/java/com/plannaplan/responses/models/GetCoursesWithGroupsResponse.java +++ b/restservice/src/main/java/com/plannaplan/responses/models/CoursesWithGroupsResponse.java @@ -9,28 +9,28 @@ import com.plannaplan.types.GroupType; import io.swagger.annotations.ApiModel; -@ApiModel(description = "Response shows information about groups to given course.", value = "GetCoursesWithGroupsResponse") -public class GetCoursesWithGroupsResponse extends CoursesResponse { +@ApiModel(description = "Response shows information about groups to given course.", value = "CoursesWithGroupsResponse") +public class CoursesWithGroupsResponse extends CoursesResponse { - private List lectures = new ArrayList<>(); - private List classes = new ArrayList<>(); + private List lectures = new ArrayList<>(); + private List classes = new ArrayList<>(); - public GetCoursesWithGroupsResponse(Course course) { + public CoursesWithGroupsResponse(Course course) { super(course); course.getGroups().stream().forEach(group -> { if (group.getType() == GroupType.CLASS) { - this.classes.add(new DefaultGroupResponse(group)); + this.classes.add(new GroupDefaultResponse(group)); } else { - this.lectures.add(new DefaultGroupResponse(group)); + this.lectures.add(new GroupDefaultResponse(group)); } }); } - public List getClasses() { + public List getClasses() { return this.classes; } - public List getLectures() { + public List getLectures() { return this.lectures; } diff --git a/restservice/src/main/java/com/plannaplan/responses/models/DefaultGroupResponse.java b/restservice/src/main/java/com/plannaplan/responses/models/GroupDefaultResponse.java similarity index 90% rename from restservice/src/main/java/com/plannaplan/responses/models/DefaultGroupResponse.java rename to restservice/src/main/java/com/plannaplan/responses/models/GroupDefaultResponse.java index 72659cc..165be0f 100755 --- a/restservice/src/main/java/com/plannaplan/responses/models/DefaultGroupResponse.java +++ b/restservice/src/main/java/com/plannaplan/responses/models/GroupDefaultResponse.java @@ -7,8 +7,8 @@ import com.plannaplan.types.GroupType; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -@ApiModel(description = "Response shows information about given group", value = "DefaultGroupResponse") -public class DefaultGroupResponse { +@ApiModel(description = "Response shows information about given group.", value = "GroupDefaultResponse") +public class GroupDefaultResponse { @ApiModelProperty(value = "ID created by database.") private Long id; @@ -28,7 +28,7 @@ public class DefaultGroupResponse { @ApiModelProperty(value = "Value shows kind of group. The types are LECTURE or CLASS.") private GroupType type; - public DefaultGroupResponse(Groups group) { + public GroupDefaultResponse(Groups group) { this.id = group.getId() != null ? group.getId() : null; this.day = group.getDay() != null ? group.getDay().label : -1; this.time = group.getTimeString() != null ? group.getTimeString() : ""; @@ -37,7 +37,7 @@ public class DefaultGroupResponse { this.type = group.getType() != null ? group.getType() : null; } - public DefaultGroupResponse(Assignment assignment) { + public GroupDefaultResponse(Assignment assignment) { this(assignment.getGroup()); } diff --git a/restservice/src/main/java/com/plannaplan/responses/models/WithCapacityGroupResponse.java b/restservice/src/main/java/com/plannaplan/responses/models/GroupWithCapacityResponse.java similarity index 64% rename from restservice/src/main/java/com/plannaplan/responses/models/WithCapacityGroupResponse.java rename to restservice/src/main/java/com/plannaplan/responses/models/GroupWithCapacityResponse.java index ad422e6..8e7a1f8 100755 --- a/restservice/src/main/java/com/plannaplan/responses/models/WithCapacityGroupResponse.java +++ b/restservice/src/main/java/com/plannaplan/responses/models/GroupWithCapacityResponse.java @@ -4,17 +4,17 @@ import com.plannaplan.entities.Assignment; import com.plannaplan.entities.Groups; import io.swagger.annotations.ApiModel; -@ApiModel(description = "Response shows information about group with included capacity.", value = "WithCapacityGroupResponse") -public class WithCapacityGroupResponse extends DefaultGroupResponse { +@ApiModel(description = "Response shows information about group with included capacity.", value = "GroupWithCapacityResponse") +public class GroupWithCapacityResponse extends GroupDefaultResponse { private int capacity; - public WithCapacityGroupResponse(Groups group) { + public GroupWithCapacityResponse(Groups group) { super(group); this.capacity = group.getCapacity(); } - public WithCapacityGroupResponse(Assignment assignment) { + public GroupWithCapacityResponse(Assignment assignment) { this(assignment.getGroup()); } diff --git a/restservice/src/main/java/com/plannaplan/responses/models/SearchForStudentsResponse.java b/restservice/src/main/java/com/plannaplan/responses/models/UserResponse.java similarity index 83% rename from restservice/src/main/java/com/plannaplan/responses/models/SearchForStudentsResponse.java rename to restservice/src/main/java/com/plannaplan/responses/models/UserResponse.java index 5e4b2b6..166718c 100755 --- a/restservice/src/main/java/com/plannaplan/responses/models/SearchForStudentsResponse.java +++ b/restservice/src/main/java/com/plannaplan/responses/models/UserResponse.java @@ -4,15 +4,15 @@ import com.plannaplan.entities.User; import io.swagger.annotations.ApiModel; -@ApiModel(description = "Response shows information about user.", value = "SearchForStudentsResponse") -public class SearchForStudentsResponse { +@ApiModel(description = "Response shows information about user.", value = "UserResponse") +public class UserResponse { private Long id; private String name; private String surname; private String email; - public SearchForStudentsResponse(User user) { + public UserResponse(User user) { this.id = user.getId(); this.name = user.getName(); this.surname = user.getSurname();