judge4c/src/features/user-management/config/problem.ts
liguang 42e576876e feat(user-management): 实现用户管理和题目管理功能
- 新增用户管理和题目管理的 API 接口
- 实现用户管理和题目管理的后端逻辑
- 添加保护布局组件,用于权限控制
- 创建用户管理的不同角色页面
- 移除不必要的数据文件和旧的页面组件
2025-06-19 16:13:50 +08:00

42 lines
1.3 KiB
TypeScript

import { z } from "zod";
export const problemSchema = z.object({
id: z.string(),
displayId: z.number(),
difficulty: z.string(),
createdAt: z.string(),
});
export const addProblemSchema = z.object({
displayId: z.number(),
difficulty: z.string(),
});
export const editProblemSchema = z.object({
id: z.string(),
displayId: z.number(),
difficulty: z.string(),
});
export const problemConfig = {
userType: "problem",
title: "题目列表",
apiPath: "/api/problem",
columns: [
{ key: "id", label: "ID", sortable: true },
{ key: "displayId", label: "题目编号", sortable: true, searchable: true, placeholder: "搜索编号" },
{ key: "difficulty", label: "难度", sortable: true, searchable: true, placeholder: "搜索难度" },
{ key: "createdAt", label: "创建时间", sortable: true },
],
formFields: [
{ key: "displayId", label: "题目编号", type: "number", required: true },
{ key: "difficulty", label: "难度", type: "text", required: true },
],
actions: {
add: { label: "添加题目", icon: "PlusIcon" },
edit: { label: "编辑", icon: "PencilIcon" },
delete: { label: "删除", icon: "TrashIcon" },
batchDelete: { label: "批量删除", icon: "TrashIcon" },
},
pagination: { pageSizes: [10, 50, 100, 500], defaultPageSize: 10 },
};