fix up git
This commit is contained in:
@@ -86,6 +86,7 @@ export interface GitHubStatus {
|
||||
githubLogin?: string;
|
||||
connectedAt?: string;
|
||||
scope?: string;
|
||||
canDeleteRepos?: boolean;
|
||||
}
|
||||
|
||||
export const apiGitHub = {
|
||||
@@ -106,6 +107,37 @@ export const apiGitHub = {
|
||||
},
|
||||
};
|
||||
|
||||
export interface GitHubRepoItem {
|
||||
key: string;
|
||||
ownerLogin: string;
|
||||
repoName: string;
|
||||
repoHtmlUrl: string;
|
||||
private?: boolean;
|
||||
examRoomId?: number;
|
||||
examRoomName?: string;
|
||||
studentLabel?: string;
|
||||
publishMode?: 'room' | 'student' | '';
|
||||
createdAt: string;
|
||||
updatedAt?: string;
|
||||
fromSimpleCare?: boolean;
|
||||
}
|
||||
|
||||
export const apiGitHubRepos = {
|
||||
list: async (): Promise<{ data: GitHubRepoItem[]; total: number; githubLogin?: string }> => {
|
||||
const res = await staffFetch('/auth/github/repos');
|
||||
if (!res.ok) await parseError(res, 'Không tải danh sách repo');
|
||||
return res.json();
|
||||
},
|
||||
bulkDelete: async (repos: string[]) => {
|
||||
const res = await staffFetch('/auth/github/repos/bulk-delete', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ repos }),
|
||||
});
|
||||
if (!res.ok) await parseError(res, 'Xóa repo thất bại');
|
||||
return res.json() as Promise<{ ok: boolean; deleted: number; failures?: string[]; message: string }>;
|
||||
},
|
||||
};
|
||||
|
||||
export interface EmailDomainItem {
|
||||
id: number;
|
||||
domain: string;
|
||||
@@ -658,6 +690,8 @@ export interface ExamSubmission {
|
||||
createdAt: string;
|
||||
fullName: string;
|
||||
studentCode: string;
|
||||
gitRepoUrl?: string;
|
||||
gitPublishUrl?: string;
|
||||
}
|
||||
|
||||
export const apiExam = {
|
||||
@@ -807,4 +841,16 @@ export const apiExam = {
|
||||
if (!res.ok) await parseError(res, 'Đẩy lên Git thất bại');
|
||||
return res.json() as Promise<{ ok: boolean; url: string; gitPublishUrl: string; openUrl?: string; message: string }>;
|
||||
},
|
||||
publishSubmissionsGitStudents: async (id: number) => {
|
||||
const res = await staffFetch(`/exam-rooms/${id}/submissions/publish-git-students`, { method: 'POST' });
|
||||
if (!res.ok) await parseError(res, 'Đẩy repo từng SV thất bại');
|
||||
return res.json() as Promise<{
|
||||
ok: boolean;
|
||||
published: number;
|
||||
openUrl?: string;
|
||||
message: string;
|
||||
warnings?: string[];
|
||||
studentRepos?: { studentRkId: number; studentCode: string; fullName: string; url: string }[];
|
||||
}>;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user