Skip to content

Commit

Permalink
Merge branch 'frontend' into feature/project-automatically-visible
Browse files Browse the repository at this point in the history
  • Loading branch information
arnedierick committed May 18, 2024
2 parents 9b2f9c2 + ed87b0a commit 19ef550
Show file tree
Hide file tree
Showing 64 changed files with 2,888 additions and 1,793 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedMethods("*")
.allowedOrigins("*")
.exposedHeaders("Content-Disposition")
.allowedHeaders("*");

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

Expand Down Expand Up @@ -152,6 +153,7 @@ public ResponseEntity<?> getSubmissions(@PathVariable("projectid") long projecti
*/
@PostMapping(ApiRoutes.PROJECT_BASE_PATH + "/{projectid}/submit")
//Route to submit a file, it accepts a multiform with the file and submissionTime
@Transactional
@Roles({UserRole.teacher, UserRole.student})
public ResponseEntity<?> submitFile(@RequestParam("file") MultipartFile file, @PathVariable("projectid") long projectid, Auth auth) {
long userId = auth.getUserEntity().getId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ public CheckResult<Pair<TestEntity, ProjectEntity>> checkForTestUpdate(
return new CheckResult<>(HttpStatus.BAD_REQUEST, "A docker image is required if u add a script", null);
}

if(dockerImage != null && !DockerSubmissionTestModel.imageExists(dockerImage)) {
return new CheckResult<>(HttpStatus.BAD_REQUEST, "A valid docker image is required in a docker test.", null);
}
// This returns false if the image isn't pullt yet! FIX PLS
// if(dockerImage != null && !DockerSubmissionTestModel.imageExists(dockerImage)) {
// return new CheckResult<>(HttpStatus.BAD_REQUEST, "A valid docker image is required in a docker test.", null);
// }

if (!httpMethod.equals(HttpMethod.PATCH) && dockerTemplate != null && dockerImage == null) {
return new CheckResult<>(HttpStatus.BAD_REQUEST, "A test script and image are required in a docker template test.", null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public void testSubmitFile() throws Exception {
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(content().json(objectMapper.writeValueAsString(submissionJson)));

Thread.sleep(1000);
Thread.sleep(2000);

assertTrue(submission.getDockerAccepted());
assertEquals("dockerFeedback-test", submission.getDockerFeedback());
Expand Down
1 change: 1 addition & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/.pnp
.pnp.js
package-lock.json
/package-lock.json

# testing
/coverage
Expand Down
Loading

0 comments on commit 19ef550

Please sign in to comment.