feat: review

This commit is contained in:
moolcoov
2025-03-03 15:55:44 +03:00
parent 219cba64c0
commit f5a3fc1fdc
10 changed files with 471 additions and 114 deletions
@@ -15,6 +15,6 @@ export const getCompetition = async (id: string) => {
export const startCompetition = async (competitionId: string) => {
return await userFetch(`/competitions/${competitionId}/start`, {
method: 'POST'
method: "POST",
});
};
};
+19 -2
View File
@@ -1,12 +1,29 @@
import { apiFetch } from ".";
import { Review, Reviewer } from "../types/review";
import { Review, Reviewer, ReviewEvaluation } from "../types/review";
export const getReviewer = async (token: string) => {
return await apiFetch<Reviewer>(`/review/${token}`);
};
export const getReviewerSubmissions = async (token: string) => {
export const getReviewSubmissions = async (token: string) => {
return await apiFetch<{ submissions: Review[] }>(
`/review/${token}/submissions`,
);
};
export const getReviewSubmission = async (token: string, reviewId: string) => {
return await apiFetch<Review>(`/review/${token}/submissions/${reviewId}`);
};
export const postReviewEvaluation = async (
token: string,
reviewId: string,
evaluation: ReviewEvaluation[],
) => {
return await apiFetch(`/review/${token}/submissions/${reviewId}/evaluate`, {
method: "POST",
body: {
evaluation,
},
});
};
+3 -2
View File
@@ -9,7 +9,7 @@ export interface Review {
review_status: ReviewStatus;
evaluation?: ReviewEvaluation[];
criteries?: ReviewCriteria[];
submitted_at: Date;
submitted_at: string;
competition: string;
competition_name: string;
task: string;
@@ -17,8 +17,9 @@ export interface Review {
stdout?: string;
result?: {};
earned_points?: number;
checked_at?: Date;
checked_at?: string;
task_title: string;
description?: string;
}
export enum ReviewStatus {