feat(阶段1): monorepo 骨架与 @oj2/contract 契约包

This commit is contained in:
2026-08-06 20:39:39 -06:00
parent 39ad431e31
commit 9bfe629cd7
8 changed files with 99 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
{
"name": "@oj2/contract",
"version": "0.0.0",
"private": true,
"type": "module",
"main": "./src/index.ts",
"types": "./src/index.ts",
"exports": { ".": "./src/index.ts" },
"dependencies": {
"zod": "^4.0.0"
}
}

View File

@@ -0,0 +1 @@
export * from "./problem"

View File

@@ -0,0 +1,13 @@
import { z } from "zod"
/** 题目列表项。字段取自 problem 表,只含列表页需要的列。 */
export const problemSummarySchema = z.object({
id: z.number().int(),
_id: z.string(), // 展示用编号,与自增 id 不同
title: z.string(),
difficulty: z.string(),
submissionNumber: z.number().int(),
acceptedNumber: z.number().int(),
})
export type ProblemSummary = z.infer<typeof problemSummarySchema>

View File

@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src"]
}