Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions frontend/src/api/evaluationApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export async function getStudentEvaluationForm(semesterId) {
return unwrapResponse(response);
}

export async function getAllCriteria() {
const response = await apiRequest(`/v1/criterias`);
return unwrapResponse(response);
}

export async function submitStudentEvaluation({ semesterId, details, isDraft }) {
const normalizedDetails = Object.entries(details || {}).reduce((accumulator, [key, value]) => {
const numericValue = Number(value);
Expand Down
25 changes: 25 additions & 0 deletions frontend/src/api/monitorEvaluationApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { apiRequest } from '../shared/api/http';

export async function getMonitorClassEvaluations(semesterId) {
if (!semesterId) return [];
const response = await apiRequest(`/v1/monitor/evaluations/class-list?semesterId=${semesterId}`);
return response?.data || response || [];
}

export async function getMonitorEvaluationDetail(evaluationId) {
if (!evaluationId) return null;
const response = await apiRequest(`/v1/monitor/evaluations/${evaluationId}`);
return response?.data || response;
}

export async function submitMonitorReview(evaluationId, adjustedDetails) {
const payload = {
evaluationId,
adjustedDetails
};
const response = await apiRequest(`/v1/monitor/evaluations/review`, {
method: 'POST',
body: JSON.stringify(payload)
});
return response;
}
Comment on lines +1 to +25

Copilot AI Apr 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file duplicates monitor evaluation endpoints that already exist in src/api/evaluationApi.js (e.g. getMonitorEvaluationDetail, .../review). Keeping two clients for the same endpoints risks them diverging (different unwrapping, naming, error handling). Consider consolidating on a single API module and re-exporting helpers if needed.

Copilot uses AI. Check for mistakes.
20 changes: 20 additions & 0 deletions frontend/src/api/studentEvaluationApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { apiRequest } from '../shared/api/http';

export async function getEvaluationForm(semesterId) {
// Use apiRequest to fetch the form state for the current student
const response = await apiRequest(`/api/v1/student/evaluations/form/${semesterId}`);
// Often backend wraps data inside { data: ... }
return response.data || response;
}

export async function submitEvaluation(semesterId, payload) {
// Post payload with { isDraft, detailsJsonb }
const response = await apiRequest(`/api/v1/student/evaluations/${semesterId}/submit`, {
Comment on lines +5 to +12

Copilot AI Apr 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API module uses /api/v1/... paths, but apiRequest already prefixes requests with API_BASE_URL (default /api). That will produce /api/api/v1/... at runtime. Align the paths with the rest of the codebase (e.g. /v1/...) or remove this module if evaluationApi is the intended source of truth.

Suggested change
const response = await apiRequest(`/api/v1/student/evaluations/form/${semesterId}`);
// Often backend wraps data inside { data: ... }
return response.data || response;
}
export async function submitEvaluation(semesterId, payload) {
// Post payload with { isDraft, detailsJsonb }
const response = await apiRequest(`/api/v1/student/evaluations/${semesterId}/submit`, {
const response = await apiRequest(`/v1/student/evaluations/form/${semesterId}`);
// Often backend wraps data inside { data: ... }
return response.data || response;
}
export async function submitEvaluation(semesterId, payload) {
// Post payload with { isDraft, detailsJsonb }
const response = await apiRequest(`/v1/student/evaluations/${semesterId}/submit`, {

Copilot uses AI. Check for mistakes.
method: 'POST',
body: JSON.stringify({
isDraft: payload.isDraft,
detailsJsonb: payload.detailsJsonb
}),
});
return response.data || response;
}
Loading
Loading