feat(阶段1): monorepo 骨架与 @oj2/contract 契约包
This commit is contained in:
1 parent
39ad431e31
commit
9bfe629cd7
8 files changed
+99
No files matched your search
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./problem"
|
||||
@@ -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>
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"include": ["src"]
|
||||
}
|
||||
Reference in new issue
Block a user