diff --git a/src/main/java/de/tum/cit/aet/artemis/programming/web/repository/AuxiliaryRepositoryResource.java b/src/main/java/de/tum/cit/aet/artemis/programming/web/repository/AuxiliaryRepositoryResource.java index b0eb38f9e8fb..8c03cf7dae19 100644 --- a/src/main/java/de/tum/cit/aet/artemis/programming/web/repository/AuxiliaryRepositoryResource.java +++ b/src/main/java/de/tum/cit/aet/artemis/programming/web/repository/AuxiliaryRepositoryResource.java @@ -55,7 +55,7 @@ */ @Profile(PROFILE_CORE) @RestController -@RequestMapping("api/") +@RequestMapping("api/auxiliary-repository/") public class AuxiliaryRepositoryResource extends RepositoryResource { private final AuxiliaryRepositoryRepository auxiliaryRepositoryRepository; @@ -72,7 +72,7 @@ public AuxiliaryRepositoryResource(ProfileService profileService, UserRepository Repository getRepository(Long auxiliaryRepositoryId, RepositoryActionType repositoryActionType, boolean pullOnGet) throws GitAPIException { final var auxiliaryRepository = auxiliaryRepositoryRepository.findByIdElseThrow(auxiliaryRepositoryId); User user = userRepository.getUserWithGroupsAndAuthorities(); - repositoryAccessService.checkAccessTestOrAuxRepositoryElseThrow(false, auxiliaryRepository.getExercise(), user, "test"); + repositoryAccessService.checkAccessTestOrAuxRepositoryElseThrow(false, auxiliaryRepository.getExercise(), user, "auxiliary"); final var repoUri = auxiliaryRepository.getVcsRepositoryUri(); return gitService.getOrCheckoutRepository(repoUri, pullOnGet); } @@ -103,21 +103,21 @@ String getOrRetrieveBranchOfDomainObject(Long auxiliaryRepositoryId) { } @Override - @GetMapping(value = "auxiliary-repository/{auxiliaryRepositoryId}/files", produces = MediaType.APPLICATION_JSON_VALUE) + @GetMapping(value = "{auxiliaryRepositoryId}/files", produces = MediaType.APPLICATION_JSON_VALUE) @EnforceAtLeastTutor public ResponseEntity> getFiles(@PathVariable Long auxiliaryRepositoryId) { return super.getFiles(auxiliaryRepositoryId); } @Override - @GetMapping(value = "auxiliary-repository/{auxiliaryRepositoryId}/file", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) + @GetMapping(value = "{auxiliaryRepositoryId}/file", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) @EnforceAtLeastTutor public ResponseEntity getFile(@PathVariable Long auxiliaryRepositoryId, @RequestParam("file") String filename) { return super.getFile(auxiliaryRepositoryId, filename); } @Override - @PostMapping(value = "auxiliary-repository/{auxiliaryRepositoryId}/file", produces = MediaType.APPLICATION_JSON_VALUE) + @PostMapping(value = "{auxiliaryRepositoryId}/file", produces = MediaType.APPLICATION_JSON_VALUE) @EnforceAtLeastTutor @FeatureToggle(Feature.ProgrammingExercises) public ResponseEntity createFile(@PathVariable Long auxiliaryRepositoryId, @RequestParam("file") String filePath, HttpServletRequest request) { @@ -125,7 +125,7 @@ public ResponseEntity createFile(@PathVariable Long auxiliaryRepositoryId, } @Override - @PostMapping(value = "auxiliary-repository/{auxiliaryRepositoryId}/folder", produces = MediaType.APPLICATION_JSON_VALUE) + @PostMapping(value = "{auxiliaryRepositoryId}/folder", produces = MediaType.APPLICATION_JSON_VALUE) @EnforceAtLeastTutor @FeatureToggle(Feature.ProgrammingExercises) public ResponseEntity createFolder(@PathVariable Long auxiliaryRepositoryId, @RequestParam("folder") String folderPath, HttpServletRequest request) { @@ -133,7 +133,7 @@ public ResponseEntity createFolder(@PathVariable Long auxiliaryRepositoryI } @Override - @PostMapping(value = "auxiliary-repository/{auxiliaryRepositoryId}/rename-file", produces = MediaType.APPLICATION_JSON_VALUE) + @PostMapping(value = "{auxiliaryRepositoryId}/rename-file", produces = MediaType.APPLICATION_JSON_VALUE) @EnforceAtLeastTutor @FeatureToggle(Feature.ProgrammingExercises) public ResponseEntity renameFile(@PathVariable Long auxiliaryRepositoryId, @RequestBody FileMove fileMove) { @@ -141,7 +141,7 @@ public ResponseEntity renameFile(@PathVariable Long auxiliaryRepositoryId, } @Override - @DeleteMapping(value = "auxiliary-repository/{auxiliaryRepositoryId}/file", produces = MediaType.APPLICATION_JSON_VALUE) + @DeleteMapping(value = "{auxiliaryRepositoryId}/file", produces = MediaType.APPLICATION_JSON_VALUE) @EnforceAtLeastTutor @FeatureToggle(Feature.ProgrammingExercises) public ResponseEntity deleteFile(@PathVariable Long auxiliaryRepositoryId, @RequestParam("file") String filename) { @@ -149,14 +149,14 @@ public ResponseEntity deleteFile(@PathVariable Long auxiliaryRepositoryId, } @Override - @GetMapping(value = "auxiliary-repository/{auxiliaryRepositoryId}/pull", produces = MediaType.APPLICATION_JSON_VALUE) + @GetMapping(value = "{auxiliaryRepositoryId}/pull", produces = MediaType.APPLICATION_JSON_VALUE) @EnforceAtLeastTutor public ResponseEntity pullChanges(@PathVariable Long auxiliaryRepositoryId) { return super.pullChanges(auxiliaryRepositoryId); } @Override - @PostMapping(value = "auxiliary-repository/{auxiliaryRepositoryId}/commit", produces = MediaType.APPLICATION_JSON_VALUE) + @PostMapping(value = "{auxiliaryRepositoryId}/commit", produces = MediaType.APPLICATION_JSON_VALUE) @EnforceAtLeastTutor @FeatureToggle(Feature.ProgrammingExercises) public ResponseEntity commitChanges(@PathVariable Long auxiliaryRepositoryId) { @@ -164,7 +164,7 @@ public ResponseEntity commitChanges(@PathVariable Long auxiliaryRepository } @Override - @PostMapping(value = "auxiliary-repository/{auxiliaryRepositoryId}/reset", produces = MediaType.APPLICATION_JSON_VALUE) + @PostMapping(value = "{auxiliaryRepositoryId}/reset", produces = MediaType.APPLICATION_JSON_VALUE) @EnforceAtLeastTutor @FeatureToggle(Feature.ProgrammingExercises) public ResponseEntity resetToLastCommit(@PathVariable Long auxiliaryRepositoryId) { @@ -172,7 +172,7 @@ public ResponseEntity resetToLastCommit(@PathVariable Long auxiliaryReposi } @Override - @GetMapping(value = "auxiliary-repository/{auxiliaryRepositoryId}", produces = MediaType.APPLICATION_JSON_VALUE) + @GetMapping(value = "{auxiliaryRepositoryId}", produces = MediaType.APPLICATION_JSON_VALUE) @EnforceAtLeastTutor public ResponseEntity getStatus(@PathVariable Long auxiliaryRepositoryId) throws GitAPIException { return super.getStatus(auxiliaryRepositoryId); @@ -187,16 +187,16 @@ public ResponseEntity getStatus(@PathVariable Long auxiliar * @param principal used to check if the user can update the files * @return {Map} file submissions or the appropriate http error */ - @PutMapping("auxiliary-repository/{auxiliaryRepositoryId}/files") + @PutMapping("{auxiliaryRepositoryId}/files") @EnforceAtLeastTutor - public ResponseEntity> updateTestFiles(@PathVariable("auxiliaryRepositoryId") Long auxiliaryRepositoryId, @RequestBody List submissions, - @RequestParam Boolean commit, Principal principal) { + public ResponseEntity> updateAuxiliaryFiles(@PathVariable("auxiliaryRepositoryId") Long auxiliaryRepositoryId, + @RequestBody List submissions, @RequestParam Boolean commit, Principal principal) { if (versionControlService.isEmpty()) { throw new ResponseStatusException(HttpStatus.SERVICE_UNAVAILABLE, "VCSNotPresent"); } AuxiliaryRepository auxiliaryRepository = auxiliaryRepositoryRepository.findByIdElseThrow(auxiliaryRepositoryId); - ProgrammingExercise exercise = programmingExerciseRepository.findByIdWithTemplateAndSolutionParticipationElseThrow(auxiliaryRepository.getExercise().getId()); + ProgrammingExercise exercise = auxiliaryRepository.getExercise(); Repository repository; try { diff --git a/src/main/webapp/app/exercises/programming/manage/services/programming-exercise-participation.service.ts b/src/main/webapp/app/exercises/programming/manage/services/programming-exercise-participation.service.ts index 5b437f9f2a6b..b44b87386158 100644 --- a/src/main/webapp/app/exercises/programming/manage/services/programming-exercise-participation.service.ts +++ b/src/main/webapp/app/exercises/programming/manage/services/programming-exercise-participation.service.ts @@ -192,9 +192,9 @@ export class ProgrammingExerciseParticipationService implements IProgrammingExer * @param repositoryType the repositories type * @param auxiliaryRepositoryId the id of the repository */ - retrieveCommitHistoryForAuxiliaryRepository(exerciseId: number, repositoryType: string, auxiliaryRepositoryId: number): Observable { + retrieveCommitHistoryForAuxiliaryRepository(exerciseId: number, auxiliaryRepositoryId: number): Observable { const params: { [key: string]: number } = {}; params['repositoryId'] = auxiliaryRepositoryId; - return this.http.get(`${this.resourceUrl}${exerciseId}/commit-history/${repositoryType}`, { params: params }); + return this.http.get(`${this.resourceUrl}${exerciseId}/commit-history/AUXILIARY`, { params: params }); } } diff --git a/src/main/webapp/app/localvc/commit-history/commit-history.component.ts b/src/main/webapp/app/localvc/commit-history/commit-history.component.ts index 22b513cb6530..f734f9f2eec3 100644 --- a/src/main/webapp/app/localvc/commit-history/commit-history.component.ts +++ b/src/main/webapp/app/localvc/commit-history/commit-history.component.ts @@ -158,7 +158,7 @@ export class CommitHistoryComponent implements OnInit, OnDestroy { */ private handleAuxiliaryRepositoryCommits() { this.commitsInfoSubscription = this.programmingExerciseParticipationService - .retrieveCommitHistoryForAuxiliaryRepository(this.exerciseId, this.repositoryType, this.repositoryId!) + .retrieveCommitHistoryForAuxiliaryRepository(this.exerciseId, this.repositoryId!) .subscribe((commits) => { this.commits = this.sortCommitsByTimestampDesc(commits); });