feat(阶段1): monorepo 骨架与 @oj2/contract 契约包
This commit is contained in:
12
packages/contract/package.json
Normal file
12
packages/contract/package.json
Normal 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"
|
||||
}
|
||||
}
|
||||
1
packages/contract/src/index.ts
Normal file
1
packages/contract/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./problem"
|
||||
13
packages/contract/src/problem.ts
Normal file
13
packages/contract/src/problem.ts
Normal 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>
|
||||
4
packages/contract/tsconfig.json
Normal file
4
packages/contract/tsconfig.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"include": ["src"]
|
||||
}
|
||||
Reference in New Issue
Block a user