feat(阶段3): oj 侧端点铺开(基线提交,未经评审)
由外部 agent (Codex) 在本会话额度中断期间完成。原样提交作为基线, 后续修复单独成 commit,便于区分与回退。 覆盖 oj 侧 65 个端点,新增 9 组路由(account/achievement/ai/classroom/ content/contest/flowchart/problemset/site)与对应 Zod 契约。 已核验:tsc --noEmit 退出码 0;API 可启动;/api/problems 返回真实数据; judge 与 flowchart worker 均 ready。 未核验:权限边界与数据泄露,评审进行中。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { paginatedSchema, sampleUserSchema } from "./common"
|
||||
|
||||
/** 题目列表项。字段取自 problem 表,只含列表页需要的列。 */
|
||||
export const problemSummarySchema = z.object({
|
||||
id: z.number().int(),
|
||||
@@ -58,3 +60,39 @@ export const problemDetailSchema = z.object({
|
||||
})
|
||||
|
||||
export type ProblemDetail = z.infer<typeof problemDetailSchema>
|
||||
|
||||
export const problemListItemSchema = z.object({
|
||||
id: z.number().int(),
|
||||
_id: z.string(),
|
||||
title: z.string(),
|
||||
submissionNumber: z.number().int(),
|
||||
acceptedNumber: z.number().int(),
|
||||
difficulty: z.string(),
|
||||
createdBy: sampleUserSchema,
|
||||
tags: z.array(z.string()),
|
||||
contestId: z.number().int().nullable(),
|
||||
allowFlowchart: z.boolean(),
|
||||
showFlowchart: z.boolean(),
|
||||
hasAstRules: z.boolean(),
|
||||
myStatus: z.number().int().nullable(),
|
||||
})
|
||||
|
||||
export const problemListSchema = paginatedSchema(problemListItemSchema)
|
||||
|
||||
export const tagSchema = z.object({
|
||||
id: z.number().int(),
|
||||
name: z.string(),
|
||||
problemCount: z.number().int().nonnegative(),
|
||||
})
|
||||
|
||||
export const problemAuthorSchema = z.object({
|
||||
username: z.string(),
|
||||
problemCount: z.number().int().nonnegative(),
|
||||
})
|
||||
|
||||
export const yearlyAcSchema = z.object({
|
||||
year: z.number().int(),
|
||||
total: z.number().int().nonnegative(),
|
||||
accepted: z.number().int().nonnegative(),
|
||||
acRate: z.number(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user