- 前端 oj/api.ts、admin/api.ts、shared/api.ts 的 post / put 请求体一律 `satisfies XxxRequest`, 只在编译期检查,不加运行时校验(和「只在三处挂运行时闸门」的规矩一致) - 契约里的 XxxRequest 从 z.infer 改成 z.input:请求类型描述的是「客户端可以发什么」, 带默认值的字段可以不传。后端从不用这些类型(它用 parse 出来的 data),不受影响 - 补了四个漏导出的请求类型(比赛题目排序、题单题目排序、标签分类、检查用户名) - 接上之后对不上的几处:编辑用户的角色和题目权限经 toAdminType / toProblemPermission 收窄,导入用户的行改成四元组,练习题数据改成 Record,格式化的语言只收后端认的四种 (isFormatLanguage)。出题页和成就的请求体是「表单校验兜底、出站补默认值」, 用 Partial<…> 只核键名和值的类型 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
309ca0ece2
commit
4dfd14f95b
18 files changed
+251
-131
No files matched your search
@@ -71,8 +71,8 @@ export const problemRankSchema = z.object({
|
||||
|
||||
export const publicProfileSchema = userProfileSchema
|
||||
|
||||
export type RegisterRequest = z.infer<typeof registerRequestSchema>
|
||||
export type UpdateProfileRequest = z.infer<typeof updateProfileRequestSchema>
|
||||
export type RegisterRequest = z.input<typeof registerRequestSchema>
|
||||
export type UpdateProfileRequest = z.input<typeof updateProfileRequestSchema>
|
||||
export type ProblemRank = z.infer<typeof problemRankSchema>
|
||||
export type RankProfile = z.infer<typeof rankProfileSchema>
|
||||
export type WeeklyRankItem = z.infer<typeof weeklyRankItemSchema>
|
||||
|
||||
@@ -1118,7 +1118,7 @@ export type AchievementMetric = z.infer<typeof achievementMetricSchema>
|
||||
export type AdminProblem = z.infer<typeof adminProblemSchema>
|
||||
export type AdminProblemListItem = z.infer<typeof adminProblemListItemSchema>
|
||||
export type AdminProblemList = z.infer<typeof adminProblemListSchema>
|
||||
export type CreateProblemRequest = z.infer<typeof createProblemRequestSchema>
|
||||
export type CreateProblemRequest = z.input<typeof createProblemRequestSchema>
|
||||
|
||||
export type AdminContest = z.infer<typeof adminContestSchema>
|
||||
export type AdminContestList = z.infer<typeof adminContestListSchema>
|
||||
@@ -1153,67 +1153,70 @@ export type BatchProblemTagResponse = z.infer<typeof batchProblemTagResponseSche
|
||||
export type SqlTestCaseScript = z.infer<typeof sqlTestCaseScriptSchema>
|
||||
export type GenerateSqlTestCaseResponse = z.infer<typeof generateSqlTestCaseResponseSchema>
|
||||
export type TestCaseFiles = z.infer<typeof testCaseFilesSchema>
|
||||
export type AstCheckRequest = z.infer<typeof astCheckRequestSchema>
|
||||
export type AstCheckRequest = z.input<typeof astCheckRequestSchema>
|
||||
export type AstCheckResponse = z.infer<typeof astCheckResponseSchema>
|
||||
export type GenerateTestInputsRequest = z.infer<typeof generateTestInputsRequestSchema>
|
||||
export type GenerateTestInputsRequest = z.input<typeof generateTestInputsRequestSchema>
|
||||
export type GenerateTestInputsResponse = z.infer<typeof generateTestInputsResponseSchema>
|
||||
|
||||
export type AdminAnnouncementList = z.infer<typeof adminAnnouncementListSchema>
|
||||
export type CreateAnnouncementRequest = z.infer<typeof createAnnouncementRequestSchema>
|
||||
export type UpdateAnnouncementRequest = z.infer<typeof updateAnnouncementRequestSchema>
|
||||
export type CreateAnnouncementRequest = z.input<typeof createAnnouncementRequestSchema>
|
||||
export type UpdateAnnouncementRequest = z.input<typeof updateAnnouncementRequestSchema>
|
||||
export type TutorialType = z.infer<typeof tutorialTypeSchema>
|
||||
export type AdminTutorial = z.infer<typeof adminTutorialSchema>
|
||||
export type AdminTutorialListItem = z.infer<typeof adminTutorialListItemSchema>
|
||||
export type AdminTutorialGroups = z.infer<typeof adminTutorialGroupsSchema>
|
||||
export type AdminTutorialProblem = z.infer<typeof adminTutorialProblemSchema>
|
||||
export type TutorialProblemCandidate = z.infer<typeof tutorialProblemCandidateSchema>
|
||||
export type SetTutorialProblemsRequest = z.infer<typeof setTutorialProblemsRequestSchema>
|
||||
export type ReorderTutorialsRequest = z.infer<typeof reorderTutorialsRequestSchema>
|
||||
export type RenameTutorialProjectRequest = z.infer<typeof renameTutorialProjectRequestSchema>
|
||||
export type CreateTutorialRequest = z.infer<typeof createTutorialRequestSchema>
|
||||
export type UpdateTutorialRequest = z.infer<typeof updateTutorialRequestSchema>
|
||||
export type SetTutorialVisibilityRequest = z.infer<typeof setTutorialVisibilityRequestSchema>
|
||||
export type SetTutorialProblemsRequest = z.input<typeof setTutorialProblemsRequestSchema>
|
||||
export type ReorderTutorialsRequest = z.input<typeof reorderTutorialsRequestSchema>
|
||||
export type RenameTutorialProjectRequest = z.input<typeof renameTutorialProjectRequestSchema>
|
||||
export type CreateTutorialRequest = z.input<typeof createTutorialRequestSchema>
|
||||
export type UpdateTutorialRequest = z.input<typeof updateTutorialRequestSchema>
|
||||
export type SetTutorialVisibilityRequest = z.input<typeof setTutorialVisibilityRequestSchema>
|
||||
export type ExerciseType = z.infer<typeof exerciseTypeSchema>
|
||||
export type AdminExercise = z.infer<typeof adminExerciseSchema>
|
||||
export type CreateExerciseRequest = z.infer<typeof createExerciseRequestSchema>
|
||||
export type UpdateExerciseRequest = z.infer<typeof updateExerciseRequestSchema>
|
||||
export type CreateExerciseRequest = z.input<typeof createExerciseRequestSchema>
|
||||
export type UpdateExerciseRequest = z.input<typeof updateExerciseRequestSchema>
|
||||
export type ToggleAiReportPinResponse = z.infer<typeof toggleAiReportPinResponseSchema>
|
||||
export type AchievementOperator = z.infer<typeof achievementOperatorSchema>
|
||||
export type CreateAchievementRequest = z.infer<typeof createAchievementRequestSchema>
|
||||
export type UpdateAchievementRequest = z.infer<typeof updateAchievementRequestSchema>
|
||||
export type UpdateUserRequest = z.infer<typeof updateUserRequestSchema>
|
||||
export type ImportUsersRequest = z.infer<typeof importUsersRequestSchema>
|
||||
export type DeleteUsersRequest = z.infer<typeof deleteUsersRequestSchema>
|
||||
export type CreateAchievementRequest = z.input<typeof createAchievementRequestSchema>
|
||||
export type UpdateAchievementRequest = z.input<typeof updateAchievementRequestSchema>
|
||||
export type UpdateUserRequest = z.input<typeof updateUserRequestSchema>
|
||||
export type ImportUsersRequest = z.input<typeof importUsersRequestSchema>
|
||||
export type DeleteUsersRequest = z.input<typeof deleteUsersRequestSchema>
|
||||
export type ResetPasswordResponse = z.infer<typeof resetPasswordResponseSchema>
|
||||
export type UpdateWebsiteConfigRequest = z.infer<typeof updateWebsiteConfigRequestSchema>
|
||||
export type UpdateJudgeServerRequest = z.infer<typeof updateJudgeServerRequestSchema>
|
||||
export type UpdateWebsiteConfigRequest = z.input<typeof updateWebsiteConfigRequestSchema>
|
||||
export type UpdateJudgeServerRequest = z.input<typeof updateJudgeServerRequestSchema>
|
||||
export type UploadImageResponse = z.infer<typeof uploadImageResponseSchema>
|
||||
export type CreateContestRequest = z.infer<typeof createContestRequestSchema>
|
||||
export type UpdateContestRequest = z.infer<typeof updateContestRequestSchema>
|
||||
export type UpdateAcmHelperRequest = z.infer<typeof updateAcmHelperRequestSchema>
|
||||
export type CreateContestRequest = z.input<typeof createContestRequestSchema>
|
||||
export type UpdateContestRequest = z.input<typeof updateContestRequestSchema>
|
||||
export type UpdateAcmHelperRequest = z.input<typeof updateAcmHelperRequestSchema>
|
||||
export type AdminProblemSet = z.infer<typeof adminProblemSetSchema>
|
||||
export type AdminProblemSetList = z.infer<typeof adminProblemSetListSchema>
|
||||
export type CreateProblemSetRequest = z.infer<typeof createProblemSetRequestSchema>
|
||||
export type UpdateProblemSetRequest = z.infer<typeof updateProblemSetRequestSchema>
|
||||
export type CreateProblemSetRequest = z.input<typeof createProblemSetRequestSchema>
|
||||
export type UpdateProblemSetRequest = z.input<typeof updateProblemSetRequestSchema>
|
||||
export type AdminProblemSetProblem = z.infer<typeof adminProblemSetProblemSchema>
|
||||
export type AddProblemsToSetRequest = z.infer<typeof addProblemsToSetRequestSchema>
|
||||
export type AddProblemsToSetRequest = z.input<typeof addProblemsToSetRequestSchema>
|
||||
export type AddProblemsToSetResult = z.infer<typeof addProblemsToSetResultSchema>
|
||||
export type ReorderProblemSetProblemsRequest = z.infer<
|
||||
export type UpdateProblemInSetRequest = z.input<typeof updateProblemInSetRequestSchema>
|
||||
export type AdminProblemSetBadge = z.infer<typeof adminProblemSetBadgeSchema>
|
||||
export type CreateProblemSetBadgeRequest = z.input<typeof createProblemSetBadgeRequestSchema>
|
||||
export type UpdateProblemSetBadgeRequest = z.input<typeof updateProblemSetBadgeRequestSchema>
|
||||
export type RenameTagRequest = z.input<typeof renameTagRequestSchema>
|
||||
export type BatchProblemTagRequest = z.input<typeof batchProblemTagRequestSchema>
|
||||
export type BatchProblemVisibleRequest = z.input<typeof batchProblemVisibleRequestSchema>
|
||||
export type GenerateFlowchartRequest = z.input<typeof generateFlowchartRequestSchema>
|
||||
export type GenerateFlowchartResponse = z.infer<typeof generateFlowchartResponseSchema>
|
||||
export type UpdateProblemRequest = z.input<typeof updateProblemRequestSchema>
|
||||
export type MakeProblemPublicRequest = z.input<typeof makeProblemPublicRequestSchema>
|
||||
export type AddContestProblemRequest = z.input<typeof addContestProblemRequestSchema>
|
||||
export type ReorderContestProblemsRequest = z.input<typeof reorderContestProblemsRequestSchema>
|
||||
export type ReorderProblemSetProblemsRequest = z.input<
|
||||
typeof reorderProblemSetProblemsRequestSchema
|
||||
>
|
||||
export type UpdateProblemInSetRequest = z.infer<typeof updateProblemInSetRequestSchema>
|
||||
export type AdminProblemSetBadge = z.infer<typeof adminProblemSetBadgeSchema>
|
||||
export type CreateProblemSetBadgeRequest = z.infer<typeof createProblemSetBadgeRequestSchema>
|
||||
export type UpdateProblemSetBadgeRequest = z.infer<typeof updateProblemSetBadgeRequestSchema>
|
||||
export type RenameTagRequest = z.infer<typeof renameTagRequestSchema>
|
||||
export type BatchProblemTagRequest = z.infer<typeof batchProblemTagRequestSchema>
|
||||
export type BatchProblemVisibleRequest = z.infer<typeof batchProblemVisibleRequestSchema>
|
||||
export type GenerateFlowchartRequest = z.infer<typeof generateFlowchartRequestSchema>
|
||||
export type GenerateFlowchartResponse = z.infer<typeof generateFlowchartResponseSchema>
|
||||
export type UpdateProblemRequest = z.infer<typeof updateProblemRequestSchema>
|
||||
export type MakeProblemPublicRequest = z.infer<typeof makeProblemPublicRequestSchema>
|
||||
export type AddContestProblemRequest = z.infer<typeof addContestProblemRequestSchema>
|
||||
export type SetTagCategoryRequest = z.input<typeof setTagCategoryRequestSchema>
|
||||
export type CheckUsernamesRequest = z.input<typeof checkUsernamesRequestSchema>
|
||||
export type TestCaseEntry = z.infer<typeof testCaseEntrySchema>
|
||||
export type UploadTestCaseResponse = z.infer<typeof uploadTestCaseResponseSchema>
|
||||
export type SqlPreviewRequest = z.infer<typeof sqlPreviewRequestSchema>
|
||||
export type GenerateSqlTestCaseRequest = z.infer<typeof generateSqlTestCaseRequestSchema>
|
||||
export type SqlPreviewRequest = z.input<typeof sqlPreviewRequestSchema>
|
||||
export type GenerateSqlTestCaseRequest = z.input<typeof generateSqlTestCaseRequestSchema>
|
||||
@@ -248,9 +248,9 @@ export type LearningDay = z.infer<typeof learningDaySchema>
|
||||
export type LearningReport = z.infer<typeof learningReportSchema>
|
||||
export type AiAnalysisRecord = z.infer<typeof aiAnalysisRecordSchema>
|
||||
|
||||
export type AiAnalysisRequest = z.infer<typeof aiAnalysisRequestSchema>
|
||||
export type AiHintRequest = z.infer<typeof aiHintRequestSchema>
|
||||
export type AiAnalysisRequest = z.input<typeof aiAnalysisRequestSchema>
|
||||
export type AiHintRequest = z.input<typeof aiHintRequestSchema>
|
||||
export type AiHintDone = z.infer<typeof aiHintDoneSchema>
|
||||
export type AiHintFeedbackRequest = z.infer<typeof aiHintFeedbackRequestSchema>
|
||||
export type ClassAnalysisRequest = z.infer<typeof classAnalysisRequestSchema>
|
||||
export type ClassPkAnalysisRequest = z.infer<typeof classPkAnalysisRequestSchema>
|
||||
export type AiHintFeedbackRequest = z.input<typeof aiHintFeedbackRequestSchema>
|
||||
export type ClassAnalysisRequest = z.input<typeof classAnalysisRequestSchema>
|
||||
export type ClassPkAnalysisRequest = z.input<typeof classPkAnalysisRequestSchema>
|
||||
@@ -28,6 +28,6 @@ export const userProfileSchema = z.object({
|
||||
submissionNumber: z.number().int(),
|
||||
})
|
||||
|
||||
export type LoginRequest = z.infer<typeof loginRequestSchema>
|
||||
export type LoginRequest = z.input<typeof loginRequestSchema>
|
||||
export type SessionUser = z.infer<typeof sessionUserSchema>
|
||||
export type UserProfile = z.infer<typeof userProfileSchema>
|
||||
@@ -225,7 +225,7 @@ export const classTodaySchema = z.object({
|
||||
export type ClassActivity = z.infer<typeof classActivitySchema>
|
||||
export type ClassToday = z.infer<typeof classTodaySchema>
|
||||
export type LastVisit = z.infer<typeof lastVisitSchema>
|
||||
export type ClassLessonRequest = z.infer<typeof classLessonRequestSchema>
|
||||
export type ClassLessonRequest = z.input<typeof classLessonRequestSchema>
|
||||
export type ClassBoard = z.infer<typeof classBoardSchema>
|
||||
export type ClassLesson = z.infer<typeof classLessonSchema>
|
||||
export type ClassBoardProblem = z.infer<typeof classBoardProblemSchema>
|
||||
|
||||
@@ -182,13 +182,13 @@ export type AnnouncementList = z.infer<typeof announcementListSchema>
|
||||
export type ReactionKey = z.infer<typeof reactionKeySchema>
|
||||
export type ReactionCounts = z.infer<typeof reactionCountsSchema>
|
||||
export type ReactionState = z.infer<typeof reactionStateSchema>
|
||||
export type SetReactionRequest = z.infer<typeof setReactionRequestSchema>
|
||||
export type SetReactionRequest = z.input<typeof setReactionRequestSchema>
|
||||
export type Tutorial = z.infer<typeof tutorialSchema>
|
||||
export type TutorialProblem = z.infer<typeof tutorialProblemSchema>
|
||||
export type Exercise = z.infer<typeof exerciseSchema>
|
||||
export type TutorialProgress = z.infer<typeof tutorialProgressSchema>
|
||||
export type TutorialProgressPing = z.infer<typeof tutorialProgressPingSchema>
|
||||
export type ExerciseAttemptRequest = z.infer<typeof exerciseAttemptRequestSchema>
|
||||
export type ExerciseAttemptRequest = z.input<typeof exerciseAttemptRequestSchema>
|
||||
|
||||
/**
|
||||
* 「学完一课」的口径:**这课的练一练全做对**。没有练一练的课,打开过就算。
|
||||
|
||||
@@ -152,5 +152,5 @@ export type ContestScoreboard = z.infer<typeof contestScoreboardSchema>
|
||||
export type ContestClassView = z.infer<typeof contestClassViewSchema>
|
||||
|
||||
export type ContestStatus = z.infer<typeof contestStatusSchema>
|
||||
export type ContestPasswordRequest = z.infer<typeof contestPasswordRequestSchema>
|
||||
export type ContestPasswordRequest = z.input<typeof contestPasswordRequestSchema>
|
||||
export type ContestProblems = z.infer<typeof contestProblemsSchema>
|
||||
@@ -175,6 +175,6 @@ export type FlowchartListItem = z.infer<typeof flowchartListItemSchema>
|
||||
export type FlowchartList = z.infer<typeof flowchartListSchema>
|
||||
export type FlowchartScores = z.infer<typeof flowchartScoresSchema>
|
||||
export type CreateFlowchartResponse = z.infer<typeof createFlowchartResponseSchema>
|
||||
export type CreateFlowchartRequest = z.infer<typeof createFlowchartRequestSchema>
|
||||
export type CreateFlowchartRequest = z.input<typeof createFlowchartRequestSchema>
|
||||
|
||||
export type FlowchartStatus = z.infer<typeof flowchartStatusSchema>
|
||||
@@ -164,4 +164,4 @@ export type UserBadge = z.infer<typeof userBadgeSchema>
|
||||
export type BadgeConditionType = z.infer<typeof badgeConditionTypeSchema>
|
||||
|
||||
export type ProblemSetUserProgressSummary = z.infer<typeof problemSetUserProgressSummarySchema>
|
||||
export type JoinProblemSetRequest = z.infer<typeof joinProblemSetRequestSchema>
|
||||
export type JoinProblemSetRequest = z.input<typeof joinProblemSetRequestSchema>
|
||||
@@ -118,7 +118,7 @@ export type RankTrend = z.infer<typeof rankTrendSchema>
|
||||
export type RankBoard = z.infer<typeof rankBoardSchema>
|
||||
export type ClassBattleItem = z.infer<typeof classBattleItemSchema>
|
||||
export type WeeklyChampion = z.infer<typeof weeklyChampionSchema>
|
||||
export type RankHiddenRequest = z.infer<typeof rankHiddenRequestSchema>
|
||||
export type RankHiddenRequest = z.input<typeof rankHiddenRequestSchema>
|
||||
|
||||
/**
|
||||
* 班级详情(设计稿「班级详情 · 老师 / 学生」)。原来弹框里的四分位数、四分位距、标准差、
|
||||
|
||||
@@ -617,7 +617,7 @@ export type TrialRunResponse =
|
||||
|
||||
export type StatisticInfo = z.infer<typeof statisticInfoSchema>
|
||||
export type SubmissionTrace = z.infer<typeof submissionTraceSchema>
|
||||
export type CreateSubmissionRequest = z.infer<typeof createSubmissionRequestSchema>
|
||||
export type CreateSubmissionRequest = z.input<typeof createSubmissionRequestSchema>
|
||||
export type SubmissionDetail = z.infer<typeof submissionDetailSchema>
|
||||
export type SubmissionUpdate = z.infer<typeof submissionUpdateSchema>
|
||||
export type SubmissionStatistics = z.infer<typeof submissionStatisticsSchema>
|
||||
@@ -633,5 +633,5 @@ export type SubmissionList = z.infer<typeof submissionListSchema>
|
||||
export type CreateSubmissionResponse = z.infer<typeof createSubmissionResponseSchema>
|
||||
export type FormatCodeResponse = z.infer<typeof formatCodeResponseSchema>
|
||||
|
||||
export type FormatCodeRequest = z.infer<typeof formatCodeRequestSchema>
|
||||
export type TrialRunRequest = z.infer<typeof trialRunRequestSchema>
|
||||
export type FormatCodeRequest = z.input<typeof formatCodeRequestSchema>
|
||||
export type TrialRunRequest = z.input<typeof trialRunRequestSchema>
|
||||
Reference in new issue
Block a user