platform/lms-adm-fe release promotion snapshot
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
export type InstructorSubmissionCommitFile = {
|
||||
path: string;
|
||||
status: string;
|
||||
patch: string;
|
||||
};
|
||||
|
||||
export type InstructorSubmissionCommit = {
|
||||
hash: string;
|
||||
shortHash: string;
|
||||
message: string;
|
||||
author: string;
|
||||
authorEmail: string;
|
||||
date: string | null;
|
||||
files: InstructorSubmissionCommitFile[];
|
||||
};
|
||||
|
||||
export type InstructorSubmissionItem = {
|
||||
id: string;
|
||||
status: 'NOT_INSTALLED' | 'PENDING' | 'SUBMITTED';
|
||||
submitted: boolean;
|
||||
submittedAt: string | null;
|
||||
commitCount: number;
|
||||
score: number;
|
||||
course: {
|
||||
id: string;
|
||||
title: string;
|
||||
slug: string;
|
||||
};
|
||||
week: {
|
||||
id: string;
|
||||
week: number;
|
||||
title: string;
|
||||
};
|
||||
module: {
|
||||
id: string;
|
||||
name: string;
|
||||
folderName: string;
|
||||
sortOrder: number;
|
||||
};
|
||||
student: {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
group: string;
|
||||
};
|
||||
repository: {
|
||||
id: string;
|
||||
owner: string;
|
||||
name: string;
|
||||
url: string;
|
||||
} | null;
|
||||
commits: InstructorSubmissionCommit[];
|
||||
finalFiles: InstructorSubmissionCommitFile[];
|
||||
};
|
||||
|
||||
export type InstructorSubmissionsResponse = {
|
||||
organization: {
|
||||
id?: string;
|
||||
name: string;
|
||||
} | null;
|
||||
summary: {
|
||||
totalItems: number;
|
||||
submittedItems: number;
|
||||
pendingItems: number;
|
||||
notInstalledItems: number;
|
||||
totalCommits: number;
|
||||
};
|
||||
courses: Array<{
|
||||
id: string;
|
||||
title: string;
|
||||
slug: string;
|
||||
weeks: Array<{
|
||||
id: string;
|
||||
week: number;
|
||||
title: string;
|
||||
modules: Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
folderName: string;
|
||||
sortOrder: number;
|
||||
}>;
|
||||
}>;
|
||||
}>;
|
||||
students: Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
group: string;
|
||||
}>;
|
||||
items: InstructorSubmissionItem[];
|
||||
};
|
||||
|
||||
const LMS_API_BASE_URL = (import.meta.env.VITE_API_BASE_URL ?? 'http://localhost:4400/api').replace(/\/+$/, '');
|
||||
|
||||
export async function listInstructorSubmissions(accessToken: string): Promise<InstructorSubmissionsResponse> {
|
||||
const response = await fetch(`${LMS_API_BASE_URL}/instructor/submissions`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`제출 현황을 불러오지 못했습니다. (${response.status})`);
|
||||
}
|
||||
|
||||
return response.json() as Promise<InstructorSubmissionsResponse>;
|
||||
}
|
||||
|
||||
export async function saveInstructorSubmissionScore(
|
||||
accessToken: string,
|
||||
input: { studentId: string; weekId: string; score: number },
|
||||
): Promise<{ score: number }> {
|
||||
const response = await fetch(`${LMS_API_BASE_URL}/instructor/submissions/score`, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`점수를 저장하지 못했습니다. (${response.status})`);
|
||||
}
|
||||
|
||||
return response.json() as Promise<{ score: number }>;
|
||||
}
|
||||
Reference in New Issue
Block a user