Skip to content

Commit

Permalink
set up routing for QS_3 closes #46
Browse files Browse the repository at this point in the history
  • Loading branch information
dserafim1999 committed Jul 4, 2020
1 parent 05dc5db commit 08e7d5f
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
Expand Up @@ -37,7 +37,7 @@ public ReviewDto createReview(@PathVariable int executionId, @Valid @RequestBody
return submissionService.createReview(reviewDto);
}

@PutMapping("/management/review/{questionId}")
@PutMapping("/management/reviews/{questionId}")
@PreAuthorize("hasRole('ROLE_TEACHER')")
public void toggleInReviewStatus(@PathVariable int questionId, @Valid @RequestParam boolean inReview) {
submissionService.toggleInReviewStatus(questionId, inReview);
Expand All @@ -60,7 +60,7 @@ public List<SubmissionDto> getCourseExecutionSubmissions(@PathVariable int execu
return submissionService.getCourseExecutionSubmissions(executionId);
}

@GetMapping("/submission/{submissionId}/reviews")
@GetMapping("/submissions/{submissionId}/reviews")
@PreAuthorize("hasRole('ROLE_TEACHER') or hasRole('ROLE_STUDENT')")
public List<ReviewDto> getSubmissionReviews(@PathVariable int submissionId) {
return submissionService.getSubmissionReviews(submissionId);
Expand Down
53 changes: 53 additions & 0 deletions frontend/src/services/RemoteServices.ts
Expand Up @@ -604,6 +604,59 @@ export default class RemoteServices {
});
}

static async toggleInReviewStatus(questionId: number){
return httpClient
.put(`/management/reviews/${questionId}`)
.catch(async error => {
throw Error(await this.errorMessage(error));
});
}

static async getStudentSubmissions(): Promise<Submission[]> {
return httpClient
.get(
`/student/submissions?executionId=${Store.getters.getCurrentCourse.courseExecutionId}`
)
.then(response => {
return response.data.map((submission: any) => {
return new Submission(submission);
});
})
.catch(async error => {
throw Error(await this.errorMessage(error));
});
}

static async getCourseExecutionSubmissions(): Promise<Submission[]> {
return httpClient
.get(
`/executions/${Store.getters.getCurrentCourse.courseExecutionId}/submissions`
)
.then(response => {
return response.data.map((submission: any) => {
return new Submission(submission);
});
})
.catch(async error => {
throw Error(await this.errorMessage(error));
});
}

static async getSubmissionReviews(submissionId: number): Promise<Review[]> {
return httpClient
.get(
`/submissions/${submissionId}/reviews`
)
.then(response => {
return response.data.map((review: any) => {
return new Review(review);
});
})
.catch(async error => {
throw Error(await this.errorMessage(error));
});
}

static async exportAll() {
return httpClient
.get('/admin/export', {
Expand Down

0 comments on commit 08e7d5f

Please sign in to comment.