add contest problems.

This commit is contained in:
2023-03-30 23:18:31 +08:00
parent 451e8d7c70
commit 70a4b67b58
10 changed files with 378 additions and 176 deletions

View File

@@ -16,11 +16,19 @@ export async function getProblemList(
offset = 0,
limit = 10,
keyword: string,
contestID?: string
contestID?: string,
ruleType?: "ACM" | "OI"
) {
const endpoint = !!contestID ? "admin/contest/problem" : "admin/problem"
const res = await http.get(endpoint, {
params: { paging: true, offset, limit, keyword, contest_id: contestID },
params: {
paging: true,
offset,
limit,
keyword,
contest_id: contestID,
rule_type: ruleType,
},
})
return {
results: res.data.results.map((result: AdminProblem) => ({
@@ -129,3 +137,15 @@ export function getContest(id: string) {
params: { id },
})
}
export function addProblemForContest(
contestID: string,
problemID: number,
displayID: string
) {
return http.post("admin/contest/add_problem_from_public", {
contest_id: contestID,
problem_id: problemID,
display_id: displayID,
})
}