Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alle endpoints overlopen en aan de ApiDog toegevoegd, en docstrings toegevoegd aan de backend code #278

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public ResponseEntity<?> createClusterForCourse(@PathVariable("courseid") Long c
}

/**
* Returns all groups for a cluster
* Get cluster by ID
*
* @param clusterid identifier of a cluster
* @param auth authentication object of the requesting user
Expand Down Expand Up @@ -193,9 +193,9 @@ public ResponseEntity<?> doGroupClusterUpdate(GroupClusterEntity clusterEntity,
*
* @param clusterid identifier of a cluster
* @param auth authentication object of the requesting user
* @param clusterFillMap Map object containing a map of all groups and their
* members of that cluster
* @param clusterFillMap Map object containing a map of all groups and their members of that cluster
* @return ResponseEntity<?>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-7431004">apiDog documentation</a>
* @HttpMethod PUT
* @ApiPath /api/clusters/{clusterid}/fill
* @AllowedRoles student, teacher
Expand Down Expand Up @@ -243,7 +243,18 @@ public ResponseEntity<?> fillCluster(@PathVariable("clusterid") Long clusterid,
}
}


/**
* Updates a cluster
*
* @param clusterid identifier of a cluster
* @param auth authentication object of the requesting user
* @param clusterJson ClusterJson object containing the cluster data
* @return ResponseEntity<?>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5883519">apiDog documentation</a>
* @HttpMethod PATCH
* @ApiPath /api/clusters/{clusterid}
* @AllowedRoles student, teacher
*/
@PatchMapping(ApiRoutes.CLUSTER_BASE_PATH + "/{clusterid}")
@Roles({UserRole.teacher, UserRole.student})
public ResponseEntity<?> patchCluster(@PathVariable("clusterid") Long clusterid, Auth auth, @RequestBody GroupClusterUpdateJson clusterJson) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,18 @@ public ResponseEntity<?> updateCourse(@RequestBody CourseJson courseJson, @PathV
}
}

/**
* Function to update a course
*
* @param courseJson JSON object containing the course name and description
* @param courseId ID of the course to update
* @param auth authentication object of the requesting user
* @return ResponseEntity with the updated course entity
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-6678309">apiDog documentation</a>
* @HttpMethod PATCH
* @AllowedRoles teacher, student
* @ApiPath /api/courses/{courseId}
*/
@PatchMapping(ApiRoutes.COURSE_BASE_PATH + "/{courseId}")
@Roles({UserRole.teacher, UserRole.student})
public ResponseEntity<?> patchCourse(@RequestBody CourseJson courseJson, @PathVariable long courseId, Auth auth) {
Expand Down Expand Up @@ -417,7 +429,7 @@ public ResponseEntity<?> joinCourse(Auth auth, @PathVariable Long courseId) {
* @param auth authentication object of the requesting user
* @param courseId ID of the course to get the join key from
* @return ResponseEntity with a statuscode and a JSON object containing the course information
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-6698822">apiDog documentation</a>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-6768820">apiDog documentation</a>
* @HttpMethod GET
* @AllowedRoles teacher, student
* @ApiPath /api/courses/{courseId}/join
Expand Down Expand Up @@ -496,7 +508,7 @@ private ResponseEntity<?> doRemoveFromCourse(
* @param courseId ID of the course to add the user to
* @param request JSON object containing the user id and relation
* @return ResponseEntity with a statuscode and no body
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5883723">apiDog documentation</a>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-6697093">apiDog documentation</a>
* @HttpMethod POST
* @AllowedRoles teacher, admin, student
* @ApiPath /api/courses/{courseId}/members
Expand Down Expand Up @@ -680,6 +692,17 @@ public ResponseEntity<String> deleteCourseKey(Auth auth, @PathVariable Long cour
return ResponseEntity.ok("");
}

/**
* Function to copy a course
*
* @param courseId ID of the course to copy
* @param auth authentication object of the requesting user
* @return ResponseEntity with the copied course entity
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-7254402">apiDog documentation</a>
* @HttpMethod POST
* @AllowedRoles teacher
* @ApiPath /api/courses/{courseId}/copy
*/
@PostMapping(ApiRoutes.COURSE_BASE_PATH + "/{courseId}/copy")
@Roles({UserRole.teacher})
@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ public class GroupController {

/**
* Function to get a group by its identifier
* @param groupid
* @param auth
* @return
* @param groupid identifier of a group
* @param auth authentication object of the requesting user
* @return ResponseEntity<GroupJson>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5723981">apiDog documentation</a>
* @HttpMethod GET
* @AllowedRoles student, teacher
* @ApiPath /api/groups/{groupid}
*/
@GetMapping(ApiRoutes.GROUP_BASE_PATH + "/{groupid}")
@Roles({UserRole.student, UserRole.teacher})
Expand Down Expand Up @@ -75,7 +79,7 @@ public ResponseEntity<?> getGroupById(@PathVariable("groupid") Long groupid, Aut
* @param auth authentication object of the requesting user
* @return ResponseEntity<GroupJson>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5723995">apiDog documentation</a>
* @HttpMethod Put
* @HttpMethod PUT
* @AllowedRoles teacher
* @ApiPath /api/groups/{groupid}
*/
Expand All @@ -93,7 +97,7 @@ public ResponseEntity<?> updateGroupName(@PathVariable("groupid") Long groupid,
* @param auth authentication object of the requesting user
* @return ResponseEntity<GroupJson>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5883691">apiDog documentation</a>
* @HttpMethod Patch
* @HttpMethod PATCH
* @AllowedRoles teacher
* @ApiPath /api/groups/{groupid}
*/
Expand Down Expand Up @@ -136,7 +140,7 @@ private ResponseEntity<?> doGroupNameUpdate(Long groupid, NameRequest nameReques
* @param auth authentication object of the requesting user
* @return ResponseEntity<Void>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5723998">apiDog documentation</a>
* @HttpMethod Delete
* @HttpMethod DELETE
* @AllowedRoles teacher, student
* @ApiPath /api/groups/{groupid}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class GroupFeedbackController {
* @param auth authentication object of the requesting user
* @return ResponseEntity<String>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5883691">apiDog documentation</a>
* @HttpMethod Patch
* @HttpMethod PATCH
* @AllowedRoles teacher, student
* @ApiPath /api/projects/{projectid}/groups/{groupid}/score
*/
Expand Down Expand Up @@ -83,6 +83,18 @@ public ResponseEntity<?> updateGroupScore(@PathVariable("groupid") long groupId,
return doGroupFeedbackUpdate(groupFeedbackEntity, request);
}

/**
* Function to delete the score of a group
*
* @param groupId identifier of a group
* @param projectId identifier of a project
* @param auth authentication object of the requesting user
* @return ResponseEntity<String>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-7436586">apiDog documentation</a>
* @HttpMethod Delete
* @AllowedRoles teacher, student
* @ApiPath /api/projects/{projectid}/groups/{groupid}/score
*/
@DeleteMapping(ApiRoutes.GROUP_FEEDBACK_PATH)
@Roles({UserRole.teacher, UserRole.student})
public ResponseEntity<?> deleteGroupScore(@PathVariable("groupid") long groupId, @PathVariable("projectid") long projectId, Auth auth) {
Expand All @@ -99,6 +111,19 @@ public ResponseEntity<?> deleteGroupScore(@PathVariable("groupid") long groupId,
}
}

/**
* Function to update the score of a group
*
* @param groupId identifier of a group
* @param projectId identifier of a project
* @param request request object containing the new score
* @param auth authentication object of the requesting user
* @return ResponseEntity<String>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5883690">apiDog documentation</a>
* @HttpMethod PUT
* @AllowedRoles teacher, student
* @ApiPath /api/projects/{projectid}/groups/{groupid}/score
*/
@PutMapping(ApiRoutes.GROUP_FEEDBACK_PATH)
@Roles({UserRole.teacher, UserRole.student})
public ResponseEntity<?> updateGroupScorePut(@PathVariable("groupid") long groupId, @PathVariable("projectid") long projectId, @RequestBody UpdateGroupScoreRequest request, Auth auth) {
Expand Down Expand Up @@ -136,8 +161,8 @@ public ResponseEntity<?> doGroupFeedbackUpdate(GroupFeedbackEntity groupFeedback
* @param request request object containing the new score
* @param auth authentication object of the requesting user
* @return ResponseEntity<String>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5883691">apiDog documentation</a>
* @HttpMethod Post
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-6697044">apiDog documentation</a>
* @HttpMethod POST
* @AllowedRoles teacher, student
* @ApiPath /api/groups/{groupid}/projects/{projectid}/feedback
*/
Expand Down Expand Up @@ -174,7 +199,7 @@ public ResponseEntity<?> addGroupScore(@PathVariable("groupid") long groupId, @P
* @param projectId identifier of a project
* @param auth authentication object of the requesting user
* @return ResponseEntity<Object>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5883689">apiDog documentation</a>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-7436611">apiDog documentation</a>
* @HttpMethod Get
* @AllowedRoles teacher, student
* @ApiPath /api/projects/{projectid}/groups/{groupid}/score
Expand Down Expand Up @@ -203,6 +228,17 @@ public ResponseEntity<Object> getGroupScore(@PathVariable("groupid") long groupI
return ResponseEntity.ok(entityToJsonConverter.groupFeedbackEntityToJson(groupFeedbackEntity));
}

/**
* Function to get the grades of a course
*
* @param courseId identifier of a course
* @param auth authentication object of the requesting user
* @return ResponseEntity<Object>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-7436985">apiDog documentation</a>
* @HttpMethod Get
* @AllowedRoles teacher, student
* @ApiPath /api/courses/{courseId}/grades
*/
@GetMapping(ApiRoutes.COURSE_BASE_PATH + "/{courseId}/grades")
@Roles({UserRole.teacher, UserRole.student})
public ResponseEntity<?> getCourseGrades(@PathVariable("courseId") long courseId, Auth auth) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public ResponseEntity<String> removeMemberFromGroup(@PathVariable("groupid") lon
* @param groupId ID of the group to remove the member from
* @param auth authentication object of the requesting user
* @return ResponseEntity with a string message about the operation result
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5883809">apiDog documentation</a>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-7437010">apiDog documentation</a>
* @HttpMethod DELETE
* @AllowedRoles teacher, student
* @ApiPath /api/groups/{groupid}/members
Expand Down Expand Up @@ -128,7 +128,7 @@ public ResponseEntity<Object> addMemberToGroup(@PathVariable("groupid") long gro
* @param groupId ID of the group to add the member to
* @param auth authentication object of the requesting user
* @return ResponseEntity with a list of UserJson objects containing the members of the group
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5883807">apiDog documentation</a>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-7437022">apiDog documentation</a>
* @HttpMethod POST
* @AllowedRoles teacher, student
* @ApiPath /api/groups/{groupid}/members
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class ProjectController {
/**
* Function to get all projects of a user
* @param auth authentication object of the requesting user
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5883808">apiDog documentation</a>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-6362262">apiDog documentation</a>
* @HttpMethod GET
* @AllowedRoles teacher, student
* @ApiPath /api/projects
Expand Down Expand Up @@ -206,7 +206,7 @@ private ResponseEntity<?> doProjectUpdate(ProjectEntity project, ProjectJson pro
* @param projectJson ProjectUpdateDTO object containing the new project's information
* @param auth authentication object of the requesting user
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5723887">apiDog documentation</a>
* @HttpMethod Put
* @HttpMethod PUT
* @AllowedRoles teacher
* @ApiPath /api/projects/{projectId}
* @return ResponseEntity with the created project
Expand Down Expand Up @@ -243,7 +243,7 @@ public ResponseEntity<?> putProjectById(@PathVariable Long projectId, @RequestBo
* @param projectJson ProjectUpdateDTO object containing the new project's information
* @param auth authentication object of the requesting user
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5723887">apiDog documentation</a>
* @HttpMethod Patch
* @HttpMethod PATCH
* @AllowedRoles teacher
* @ApiPath /api/projects/{projectId}
* @return ResponseEntity with the created project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class TestController {
* @param projectId the id of the project to update the tests for
* @param auth the authentication object of the requesting user
* @HttpMethod POST
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5724189">apiDog documentation</a>
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-6697175">apiDog documentation</a>
* @AllowedRoles teacher
* @ApiPath /api/projects/{projectid}/tests
* @return ResponseEntity with the updated tests
Expand All @@ -60,6 +60,16 @@ public ResponseEntity<?> updateTests(
testJson.getDockerTemplate(), testJson.getStructureTest(), HttpMethod.POST);
}

/**
* Function to update the tests of a project
* @param projectId the id of the project to update the tests for
* @param auth the authentication object of the requesting user
* @HttpMethod PATCH
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-6693478">apiDog documentation</a>
* @AllowedRoles teacher
* @ApiPath /api/projects/{projectid}/tests
* @return ResponseEntity with the updated tests
*/
@PatchMapping(ApiRoutes.PROJECT_BASE_PATH + "/{projectid}/tests")
@Roles({UserRole.teacher, UserRole.student})
public ResponseEntity<?> patchTests(
Expand All @@ -71,6 +81,16 @@ public ResponseEntity<?> patchTests(
testJson.getDockerTemplate(), testJson.getStructureTest(), HttpMethod.PATCH);
}

/**
* Function to update the tests of a project
* @param projectId the id of the project to update the tests for
* @param auth the authentication object of the requesting user
* @HttpMethod PUT
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-5724189">apiDog documentation</a>
* @AllowedRoles teacher
* @ApiPath /api/projects/{projectid}/tests
* @return ResponseEntity with the updated tests
*/
@PutMapping(ApiRoutes.PROJECT_BASE_PATH + "/{projectid}/tests")
@Roles({UserRole.teacher, UserRole.student})
public ResponseEntity<?> putTests(
Expand Down Expand Up @@ -235,6 +255,17 @@ public ResponseEntity<?> deleteTestById(@PathVariable("projectid") long projectI
return ResponseEntity.ok().build();
}

/**
* Function to upload extra files for a test
* @param projectId the id of the project to upload the files for
* @param file the file to upload
* @param auth the authentication object of the requesting user
* @HttpMethod PUT
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-7409857">apiDog documentation</a>
* @AllowedRoles teacher, student
* @ApiPath /api/projects/{projectid}/tests/extrafiles
* @return ResponseEntity with the updated tests
*/
@PutMapping(ApiRoutes.PROJECT_BASE_PATH + "/{projectid}/tests/extrafiles")
@Roles({UserRole.teacher, UserRole.student})
public ResponseEntity<?> uploadExtraTestFiles(
Expand Down Expand Up @@ -268,6 +299,16 @@ public ResponseEntity<?> uploadExtraTestFiles(
}
}

/**
* Function to delete extra files for a test
* @param projectId the id of the project to delete the files for
* @param auth the authentication object of the requesting user
* @HttpMethod DELETE
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-7409860">apiDog documentation</a>
* @AllowedRoles teacher, student
* @ApiPath /api/projects/{projectid}/tests/extrafiles
* @return ResponseEntity with the updated tests
*/
@DeleteMapping(ApiRoutes.PROJECT_BASE_PATH + "/{projectid}/tests/extrafiles")
@Roles({UserRole.teacher, UserRole.student})
public ResponseEntity<?> deleteExtraTestFiles(
Expand Down Expand Up @@ -303,6 +344,16 @@ public ResponseEntity<?> deleteExtraTestFiles(
}
}

/**
* Function to get extra files for a test
* @param projectId the id of the project to get the files for
* @param auth the authentication object of the requesting user
* @HttpMethod GET
* @ApiDog <a href="https://apidog.com/apidoc/project-467959/api-7409863">apiDog documentation</a>
* @AllowedRoles teacher, student
* @ApiPath /api/projects/{projectid}/tests/extrafiles
* @return ResponseEntity with the updated tests
*/
@GetMapping(ApiRoutes.PROJECT_BASE_PATH + "/{projectid}/tests/extrafiles")
@Roles({UserRole.teacher, UserRole.student})
public ResponseEntity<?> getExtraTestFiles(
Expand Down
Loading
Loading