fix(出题页): 改了挑战点保存,提示「保存好了」其实一条都没存上
出题页发请求时漏了 challenges 这个字段,后端又把「不带」当成「不动原来的」, 所以改动被静默丢掉。现在出题页带上它,接口也改成必须带(null 是清空), 以后再漏传会直接报错,不会再悄悄丢。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
195069450f
commit
6b5ca745bb
3 files changed
+8
-7
No files matched your search
@@ -260,9 +260,7 @@ type ProblemInput = ReturnType<typeof createProblemRequestSchema.parse>
|
||||
async function validateProblem(data: ProblemInput, previousChallenges: ProblemChallenges | null = null): Promise<{ error: string } | Validated> {
|
||||
const checked = commonChecks(data)
|
||||
if ('error' in checked) return checked
|
||||
// 不带挑战(旧版出题页)就原样留着,见契约 createProblemRequestSchema.challenges
|
||||
const normalized =
|
||||
data.challenges === undefined ? { challenges: previousChallenges } : normalizeChallenges(data.challenges, previousChallenges, data.languages)
|
||||
const normalized = normalizeChallenges(data.challenges, previousChallenges, data.languages)
|
||||
if ('error' in normalized) return normalized
|
||||
const { challenges } = normalized
|
||||
if (!checked.sql) return { sql: false, sqlDisplay: null, challenges }
|
||||
|
||||
Reference in new issue
Block a user