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

Development: Add check for REST endpoints to be in kebab case #9210

Open
wants to merge 38 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f71989c
added initial test
SimonEntholzer Aug 12, 2024
a4c3ef7
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Aug 14, 2024
a79aa9b
fixed exercise-group REST urls
SimonEntholzer Aug 16, 2024
1d77b30
moved tests
SimonEntholzer Aug 16, 2024
6941c23
refactored
SimonEntholzer Aug 16, 2024
243ec59
fixed remaining failures
SimonEntholzer Aug 16, 2024
8342ca0
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Aug 16, 2024
fb89e20
fixed small issues
SimonEntholzer Aug 17, 2024
04470d2
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Aug 23, 2024
232e460
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Aug 27, 2024
601bc9d
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 1, 2024
0d0ed21
fix url for test
SimonEntholzer Sep 1, 2024
d7591f9
fix url in jest test
SimonEntholzer Sep 1, 2024
bae73c5
merge resolving conflicts
SimonEntholzer Sep 3, 2024
38d3a2a
merge resolving conflicts
SimonEntholzer Sep 3, 2024
b8761a4
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 4, 2024
c8f947c
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 5, 2024
73d68f4
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 5, 2024
3e252c6
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 6, 2024
939fa2d
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 6, 2024
7d3a2cb
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 7, 2024
8712091
fix java docs
SimonEntholzer Sep 8, 2024
ff6f309
Update src/main/java/de/tum/in/www1/artemis/web/rest/AeolusTemplateRe…
SimonEntholzer Sep 9, 2024
88cf6d2
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 9, 2024
31e38a2
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 10, 2024
a9358fb
one regex to rule them all
SimonEntholzer Sep 10, 2024
2615458
Merge branch 'refs/heads/develop' into chore/add-kebab-case-for-rest-…
SimonEntholzer Sep 12, 2024
22fc382
simplify regex
SimonEntholzer Sep 12, 2024
24b8011
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 13, 2024
2b9d217
use suggested regex
SimonEntholzer Sep 13, 2024
8d109e1
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 13, 2024
b23c4af
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 14, 2024
886d60a
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 15, 2024
568f81e
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 17, 2024
b9ab0af
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 18, 2024
b472d27
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 21, 2024
c03c1d1
Merge branch 'develop' into chore/add-kebab-case-for-rest-call-archit…
SimonEntholzer Sep 22, 2024
4851d33
escape the dot before json
SimonEntholzer Sep 22, 2024
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 @@ -364,14 +364,14 @@ else if (courseUpdate.getCourseIcon() == null && existingCourse.getCourseIcon()
}

/**
* PUT courses/:courseId/onlineCourseConfiguration : Updates the onlineCourseConfiguration for the given course.
* PUT courses/:courseId/online-course-configuration : Updates the onlineCourseConfiguration for the given course.
*
* @param courseId the id of the course to update
* @param onlineCourseConfiguration the online course configuration to update
* @return the ResponseEntity with status 200 (OK) and with body the updated online course configuration
*/
// TODO: move into LTIResource
@PutMapping("courses/{courseId}/onlineCourseConfiguration")
@PutMapping("courses/{courseId}/online-course-configuration")
@EnforceAtLeastInstructor
@Profile(PROFILE_LTI)
public ResponseEntity<OnlineCourseConfiguration> updateOnlineCourseConfiguration(@PathVariable Long courseId,
Expand Down Expand Up @@ -821,12 +821,12 @@ public ResponseEntity<Course> getCourseWithOrganizations(@PathVariable Long cour
}

/**
* GET /courses/:courseId/lockedSubmissions Get locked submissions for course for user
* GET /courses/:courseId/locked-submissions Get locked submissions for course for user
*
* @param courseId the id of the course
* @return the ResponseEntity with status 200 (OK) and with body the course, or with status 404 (Not Found)
*/
@GetMapping("courses/{courseId}/lockedSubmissions")
@GetMapping("courses/{courseId}/locked-submissions")
@EnforceAtLeastTutor
public ResponseEntity<List<Submission>> getLockedSubmissionsForCourse(@PathVariable Long courseId) {
log.debug("REST request to get all locked submissions for course : {}", courseId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1170,13 +1170,13 @@ public ResponseEntity<ExamInformationDTO> getLatestIndividualEndDateOfExam(@Path
}

/**
* GET /courses/:courseId/exams/:examId/lockedSubmissions Get locked submissions for exam for user
* GET /courses/:courseId/exams/:examId/locked-submissions Get locked submissions for exam for user
*
* @param courseId - the id of the course
* @param examId - the id of the exam
* @return the ResponseEntity with status 200 (OK) and with body the course, or with status 404 (Not Found)
*/
@GetMapping("courses/{courseId}/exams/{examId}/lockedSubmissions")
@GetMapping("courses/{courseId}/exams/{examId}/locked-submissions")
@EnforceAtLeastInstructor
public ResponseEntity<List<Submission>> getLockedSubmissionsForExam(@PathVariable Long courseId, @PathVariable Long examId) {
log.debug("REST request to get all locked submissions for course : {}", courseId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public ExerciseGroupResource(ExerciseGroupRepository exerciseGroupRepository, Ex
}

/**
* POST /courses/{courseId}/exams/{examId}/exerciseGroups : Create a new exercise group.
* POST /courses/{courseId}/exams/{examId}/exercise-groups : Create a new exercise group.
*
* @param courseId the course to which the exercise group belongs to
* @param examId the exam to which the exercise group belongs to
Expand All @@ -92,7 +92,7 @@ public ExerciseGroupResource(ExerciseGroupRepository exerciseGroupRepository, Ex
* or with status 400 (Bad Request) if the exerciseGroup has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("courses/{courseId}/exams/{examId}/exerciseGroups")
@PostMapping("courses/{courseId}/exams/{examId}/exercise-groups")
@EnforceAtLeastEditor
public ResponseEntity<ExerciseGroup> createExerciseGroup(@PathVariable Long courseId, @PathVariable Long examId, @RequestBody ExerciseGroup exerciseGroup)
throws URISyntaxException {
Expand All @@ -117,19 +117,19 @@ public ResponseEntity<ExerciseGroup> createExerciseGroup(@PathVariable Long cour
Exam savedExam = examRepository.save(examFromDB);
ExerciseGroup savedExerciseGroup = savedExam.getExerciseGroups().getLast();

return ResponseEntity.created(new URI("/api/courses/" + courseId + "/exams/" + examId + "/exerciseGroups/" + savedExerciseGroup.getId())).body(savedExerciseGroup);
return ResponseEntity.created(new URI("/api/courses/" + courseId + "/exams/" + examId + "/exercise-groups/" + savedExerciseGroup.getId())).body(savedExerciseGroup);
}

/**
* PUT /courses/{courseId}/exams/{examId}/exerciseGroups : Update an existing exercise group.
* PUT /courses/{courseId}/exams/{examId}/exercise-groups : Update an existing exercise group.
*
* @param courseId the course to which the exercise group belongs to
* @param examId the exam to which the exercise group belongs to
* @param updatedExerciseGroup the exercise group to update
* @return the ResponseEntity with status 200 (OK) and with the body of the updated exercise group
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("courses/{courseId}/exams/{examId}/exerciseGroups")
@PutMapping("courses/{courseId}/exams/{examId}/exercise-groups")
@EnforceAtLeastEditor
public ResponseEntity<ExerciseGroup> updateExerciseGroup(@PathVariable Long courseId, @PathVariable Long examId, @RequestBody ExerciseGroup updatedExerciseGroup)
throws URISyntaxException {
Expand Down Expand Up @@ -170,14 +170,14 @@ public ResponseEntity<List<ExerciseGroup>> importExerciseGroup(@PathVariable Lon
}

/**
* GET /courses/{courseId}/exams/{examId}/exerciseGroups/{exerciseGroupId} : Find an exercise group by id.
* GET /courses/{courseId}/exams/{examId}/exercise-groups/{exerciseGroupId} : Find an exercise group by id.
*
* @param courseId the course to which the exercise group belongs to
* @param examId the exam to which the exercise group belongs to
* @param exerciseGroupId the id of the exercise group to find
* @return the ResponseEntity with status 200 (OK) and with the found exercise group as body
*/
@GetMapping("courses/{courseId}/exams/{examId}/exerciseGroups/{exerciseGroupId}")
@GetMapping("courses/{courseId}/exams/{examId}/exercise-groups/{exerciseGroupId}")
@EnforceAtLeastEditor
public ResponseEntity<ExerciseGroup> getExerciseGroup(@PathVariable Long courseId, @PathVariable Long examId, @PathVariable Long exerciseGroupId) {
log.debug("REST request to get exercise group : {}", exerciseGroupId);
Expand All @@ -189,13 +189,13 @@ public ResponseEntity<ExerciseGroup> getExerciseGroup(@PathVariable Long courseI
}

/**
* GET courses/{courseId}/exams/{examId}/exerciseGroups : Get all exercise groups of the given exam
* GET courses/{courseId}/exams/{examId}/exercise-groups : Get all exercise groups of the given exam
*
* @param courseId the course to which the exercise groups belong to
* @param examId the exam to which the exercise groups belong to
* @return the ResponseEntity with status 200 (OK) and a list of exercise groups. The list can be empty
*/
@GetMapping("courses/{courseId}/exams/{examId}/exerciseGroups")
@GetMapping("courses/{courseId}/exams/{examId}/exercise-groups")
@EnforceAtLeastEditor
public ResponseEntity<List<ExerciseGroup>> getExerciseGroupsForExam(@PathVariable Long courseId, @PathVariable Long examId) {
log.debug("REST request to get all exercise groups for exam : {}", examId);
Expand All @@ -207,7 +207,7 @@ public ResponseEntity<List<ExerciseGroup>> getExerciseGroupsForExam(@PathVariabl
}

/**
* DELETE /courses/{courseId}/exams/{examId}/exerciseGroups/{exerciseGroupId} : Delete the exercise group with the given id.
* DELETE /courses/{courseId}/exams/{examId}/exercise-groups/{exerciseGroupId} : Delete the exercise group with the given id.
*
* @param courseId the course to which the exercise group belongs to
* @param examId the exam to which the exercise group belongs to
Expand All @@ -218,7 +218,7 @@ public ResponseEntity<List<ExerciseGroup>> getExerciseGroupsForExam(@PathVariabl
* LocalCI, it does not make sense to keep these artifacts
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("courses/{courseId}/exams/{examId}/exerciseGroups/{exerciseGroupId}")
@DeleteMapping("courses/{courseId}/exams/{examId}/exercise-groups/{exerciseGroupId}")
@EnforceAtLeastInstructor
public ResponseEntity<Void> deleteExerciseGroup(@PathVariable Long courseId, @PathVariable Long examId, @PathVariable Long exerciseGroupId,
@RequestParam(defaultValue = "true") boolean deleteStudentReposBuildPlans, @RequestParam(defaultValue = "true") boolean deleteBaseReposBuildPlans) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ public ResponseEntity<List<StudentParticipation>> getAllParticipationsForCourse(
* @param participationId the participationId of the participation to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the participation, or with status 404 (Not Found)
*/
@GetMapping("participations/{participationId}/withLatestResult")
@GetMapping("participations/{participationId}/with-latest-result")
@EnforceAtLeastStudent
public ResponseEntity<StudentParticipation> getParticipationWithLatestResult(@PathVariable Long participationId) {
log.debug("REST request to get Participation : {}", participationId);
Expand Down Expand Up @@ -747,7 +747,7 @@ public ResponseEntity<StudentParticipation> getParticipationForCurrentUser(@Path
* @param participationId The participationId of the participation
* @return The latest build artifact (JAR/WAR) for the participation
*/
@GetMapping("participations/{participationId}/buildArtifact")
@GetMapping("participations/{participationId}/build-artifact")
@EnforceAtLeastStudent
public ResponseEntity<byte[]> getParticipationBuildArtifact(@PathVariable Long participationId) {
log.debug("REST request to get Participation build artifact: {}", participationId);
Expand Down Expand Up @@ -922,14 +922,14 @@ private ResponseEntity<Void> deleteParticipation(StudentParticipation participat
}

/**
* DELETE /participations/:participationId : remove the build plan of the ProgrammingExerciseStudentParticipation of the "participationId".
* DELETE /participations/:participationId/cleanup-build-plan : remove the build plan of the ProgrammingExerciseStudentParticipation of the "participationId".
* This only works for programming exercises.
*
* @param participationId the participationId of the ProgrammingExerciseStudentParticipation for which the build plan should be removed
* @param principal The identity of the user accessing this resource
* @return the ResponseEntity with status 200 (OK)
*/
@PutMapping("participations/{participationId}/cleanupBuildPlan")
@PutMapping("participations/{participationId}/cleanup-build-plan")
@EnforceAtLeastInstructor
@FeatureToggle(Feature.ProgrammingExercises)
public ResponseEntity<Participation> cleanupBuildPlan(@PathVariable Long participationId, Principal principal) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public ResponseEntity<String> getAeolusTemplate(@PathVariable ProgrammingLanguag
}

/**
* GET /api/aeolus/templates/:language/:projectType : Get the aeolus template file with the given filename<br/>
* GET /api/aeolus/templates/:language : Get the aeolus template file with the given filename
* GET /api/aeolus/template-scripts/:language/:projectType : Get the aeolus template file with the given filename<br/>
* GET /api/aeolus/template-scripts/:language : Get the aeolus template file with the given filename
* <p>
* The windfile contains the default build plan configuration for new programming exercises.
*
Expand All @@ -91,7 +91,7 @@ public ResponseEntity<String> getAeolusTemplate(@PathVariable ProgrammingLanguag
* @param testCoverage Whether the test coverage template should be used
* @return The requested file, or 404 if the file doesn't exist
*/
@GetMapping({ "templateScripts/{language}/{projectType}", "templateScripts/{language}" })
@GetMapping({ "template-scripts/{language}/{projectType}", "template-scripts/{language}" })
@EnforceAtLeastEditor
public ResponseEntity<String> getAeolusTemplateScript(@PathVariable ProgrammingLanguage language, @PathVariable Optional<ProjectType> projectType,
@RequestParam(value = "staticAnalysis", defaultValue = "false") boolean staticAnalysis,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class CourseManagementService {
* @param onlineCourseConfiguration - the updates to the online course configuration
*/
updateOnlineCourseConfiguration(courseId: number, onlineCourseConfiguration: OnlineCourseConfiguration): Observable<EntityResponseType> {
return this.http.put<OnlineCourseConfiguration>(`${this.resourceUrl}/${courseId}/onlineCourseConfiguration`, onlineCourseConfiguration, { observe: 'response' });
return this.http.put<OnlineCourseConfiguration>(`${this.resourceUrl}/${courseId}/online-course-configuration`, onlineCourseConfiguration, { observe: 'response' });
}

findAllOnlineCoursesWithRegistrationId(clientId: string): Observable<OnlineCourseDtoModel[]> {
Expand Down Expand Up @@ -442,7 +442,7 @@ export class CourseManagementService {
* @param {number} courseId - The id of the course to be searched for
*/
findAllLockedSubmissionsOfCourse(courseId: number): Observable<HttpResponse<Submission[]>> {
return this.http.get<Submission[]>(`${this.resourceUrl}/${courseId}/lockedSubmissions`, { observe: 'response' }).pipe(
return this.http.get<Submission[]>(`${this.resourceUrl}/${courseId}/locked-submissions`, { observe: 'response' }).pipe(
filter((res) => !!res.body),
tap((res) => reconnectSubmissions(res.body!)),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ export class ExamManagementService {
}

findAllLockedSubmissionsOfExam(courseId: number, examId: number) {
return this.http.get<Submission[]>(`${this.resourceUrl}/${courseId}/exams/${examId}/lockedSubmissions`, { observe: 'response' }).pipe(
return this.http.get<Submission[]>(`${this.resourceUrl}/${courseId}/exams/${examId}/locked-submissions`, { observe: 'response' }).pipe(
filter((res) => !!res.body),
tap((res) => reconnectSubmissions(res.body!)),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class ExerciseGroupService {
* @param exerciseGroup The exercise group to create.
*/
create(courseId: number, examId: number, exerciseGroup: ExerciseGroup): Observable<EntityResponseType> {
return this.http.post<ExerciseGroup>(`${this.resourceUrl}/${courseId}/exams/${examId}/exerciseGroups`, exerciseGroup, { observe: 'response' });
return this.http.post<ExerciseGroup>(`${this.resourceUrl}/${courseId}/exams/${examId}/exercise-groups`, exerciseGroup, { observe: 'response' });
}

/**
Expand All @@ -33,7 +33,7 @@ export class ExerciseGroupService {
* @param exerciseGroup The exercise group to update.
*/
update(courseId: number, examId: number, exerciseGroup: ExerciseGroup): Observable<EntityResponseType> {
return this.http.put<ExerciseGroup>(`${this.resourceUrl}/${courseId}/exams/${examId}/exerciseGroups`, exerciseGroup, { observe: 'response' });
return this.http.put<ExerciseGroup>(`${this.resourceUrl}/${courseId}/exams/${examId}/exercise-groups`, exerciseGroup, { observe: 'response' });
}

/**
Expand All @@ -43,7 +43,7 @@ export class ExerciseGroupService {
* @param exerciseGroupId The id of the exercise group to get.
*/
find(courseId: number, examId: number, exerciseGroupId: number): Observable<EntityResponseType> {
return this.http.get<ExerciseGroup>(`${this.resourceUrl}/${courseId}/exams/${examId}/exerciseGroups/${exerciseGroupId}`, { observe: 'response' });
return this.http.get<ExerciseGroup>(`${this.resourceUrl}/${courseId}/exams/${examId}/exercise-groups/${exerciseGroupId}`, { observe: 'response' });
}

/**
Expand All @@ -60,7 +60,7 @@ export class ExerciseGroupService {
params = params.set('deleteStudentReposBuildPlans', deleteStudentReposBuildPlans.toString());
params = params.set('deleteBaseReposBuildPlans', deleteBaseReposBuildPlans.toString());
}
return this.http.delete<void>(`${this.resourceUrl}/${courseId}/exams/${examId}/exerciseGroups/${exerciseGroupId}`, { params, observe: 'response' });
return this.http.delete<void>(`${this.resourceUrl}/${courseId}/exams/${examId}/exercise-groups/${exerciseGroupId}`, { params, observe: 'response' });
}

/**
Expand All @@ -69,6 +69,6 @@ export class ExerciseGroupService {
* @param examId The exam id.
*/
findAllForExam(courseId: number, examId: number): Observable<EntityArrayResponseType> {
return this.http.get<ExerciseGroup[]>(`${this.resourceUrl}/${courseId}/exams/${examId}/exerciseGroups`, { observe: 'response' });
return this.http.get<ExerciseGroup[]>(`${this.resourceUrl}/${courseId}/exams/${examId}/exercise-groups`, { observe: 'response' });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class AeolusService {
*/
getAeolusTemplateScript(language: ProgrammingLanguage, projectType?: ProjectType, staticAnalysis?: boolean, sequentialRuns?: boolean, coverage?: boolean): Observable<string> {
const uriWithParams = this.buildURIWithParams(language, projectType, staticAnalysis, sequentialRuns, coverage);
return this.http.get<string>(`${this.resourceUrl}/templateScripts/` + uriWithParams.uri, {
return this.http.get<string>(`${this.resourceUrl}/template-scripts/` + uriWithParams.uri, {
SimonEntholzer marked this conversation as resolved.
Show resolved Hide resolved
responseType: 'text' as 'json',
params: uriWithParams.params,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ export class ParticipationService {
cleanupBuildPlan(participation: StudentParticipation): Observable<EntityResponseType> {
const copy = this.convertParticipationDatesFromClient(participation);
return this.http
.put<StudentParticipation>(`${this.resourceUrl}/${participation.id}/cleanupBuildPlan`, copy, { observe: 'response' })
.put<StudentParticipation>(`${this.resourceUrl}/${participation.id}/cleanup-build-plan`, copy, { observe: 'response' })
.pipe(map((res: EntityResponseType) => this.convertParticipationResponseDatesFromServer(res)));
}

downloadArtifact(participationId: number): Observable<BuildArtifact> {
return this.http.get(`${this.resourceUrl}/${participationId}/buildArtifact`, { observe: 'response', responseType: 'blob' }).pipe(
return this.http.get(`${this.resourceUrl}/${participationId}/build-artifact`, { observe: 'response', responseType: 'blob' }).pipe(
map((res: EntityBlobResponseType) => {
const fileNameCandidate = (res.headers.get('content-disposition') || '').split('filename=')[1];
const fileName = fileNameCandidate ? fileNameCandidate.replace(/"/g, '') : 'artifact';
Expand Down
Loading
Loading