Skip to content

Commit

Permalink
feat: 编程题文档更新, sql 结构更新
Browse files Browse the repository at this point in the history
  • Loading branch information
xjq7 committed Mar 24, 2023
1 parent 28a7b08 commit 0d925c1
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 34 deletions.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,34 @@

前端编程题挑战

## 创建题目

在项目根目录下运行

```sh
pnpm qs:create <你的题目名>

# 例如我创建 demo 题目
pnpm qs:create demo
```

运行完之后会在 question/FrontEnd 目录下生成以下文件

- demo
- answer.md
- answer.mjs
- index.md
- index.mjs
- test.mjs

## 将新添加的文件写入数据库

在项目根目录下运行

```sh
pnpm qs:generate
```

## 开发

前置条件
Expand Down Expand Up @@ -132,6 +160,12 @@ sql 结构文件在 /server/sql 下
pnpm i
```

3. generate

```sh
pnpm generate
```

3. 启动

```sh
Expand Down
1 change: 1 addition & 0 deletions client/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org
1 change: 0 additions & 1 deletion question/FrontEnd/cache.json

This file was deleted.

3 changes: 2 additions & 1 deletion server/.npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
auto-install-peers=true
auto-install-peers=true
registry=https://registry.npmjs.org
67 changes: 35 additions & 32 deletions server/sql/runcode.sql
Original file line number Diff line number Diff line change
@@ -1,58 +1,61 @@
/*
Navicat Premium Data Transfer
Source Server : 107
Source Server : 42
Source Server Type : MySQL
Source Server Version : 80031
Source Host : 107.182.25.135:3306
Source Server Version : 80030 (8.0.30)
Source Host : 42.193.148.96:3306
Source Schema : runcode
Target Server Type : MySQL
Target Server Version : 80031
Target Server Version : 80030 (8.0.30)
File Encoding : 65001
Date: 02/11/2022 01:02:39
Date: 24/03/2023 15:36:32
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for stat
-- Table structure for question
-- ----------------------------
DROP TABLE IF EXISTS `stat`;
CREATE TABLE `stat` (
DROP TABLE IF EXISTS `question`;
CREATE TABLE `question` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`ip` varchar(128) NOT NULL DEFAULT '' COMMENT 'ip address',
`userAgent` varchar(256) NOT NULL DEFAULT '' COMMENT '设备信息',
`country` varchar(128) NOT NULL DEFAULT '' COMMENT '国家',
`province` varchar(128) NOT NULL DEFAULT '' COMMENT '',
`city` varchar(128) NOT NULL DEFAULT '' COMMENT '城市',
`isp` varchar(128) NOT NULL DEFAULT '' COMMENT '城市运营商',
`channel` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '来源渠道: 0: 自来, 1: v2ex, 2: 掘金, 3: tools.fun 4: github 5: google 6: baidu 7: bing',
`source` varchar(128) NOT NULL DEFAULT '' COMMENT '来源 referrer 字段, 未记录到来源则记录 referrer 用于 数据统计',
`type` int NOT NULL COMMENT '大分类',
`name` varchar(1280) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '题目名',
`introduce` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '简述',
`desc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '详情',
`level` int UNSIGNED NOT NULL COMMENT '难度',
`template` varchar(1280) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '模板',
`test` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '测试文件',
`answermd` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '参考答案',
`answer` varchar(1280) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '答案',
`tag` int UNSIGNED NULL DEFAULT NULL COMMENT '标签',
`createdAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 0 COMMENT = '访问数据' ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 28 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '题库' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for question
-- Table structure for stat
-- ----------------------------
DROP TABLE IF EXISTS `question`;
CREATE TABLE `question` (
DROP TABLE IF EXISTS `stat`;
CREATE TABLE `stat` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`type` int NOT NULL COMMENT '大分类',
`name` varchar(1280) NOT NULL COMMENT '题目名',
`introduce` varchar(1280) NOT NULL DEFAULT '' COMMENT '简述',
`desc` varchar(1280) NOT NULL DEFAULT '' COMMENT '详情',
`level` int UNSIGNED NOT NULL COMMENT '难度',
`template` varchar(1280) NOT NULL DEFAULT '' COMMENT '模板',
`test` varchar(1280) NOT NULL DEFAULT '' COMMENT '测试文件',
`answermd` varchar(1280) NOT NULL DEFAULT '' COMMENT '参考答案',
`answer` varchar(1280) NOT NULL DEFAULT '' COMMENT '答案',
`tag` int UNSIGNED COMMENT '标签',
`ip` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT 'ip address',
`userAgent` varchar(256) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '_utf8mb4\\\'\\\'' COMMENT '设备信息',
`country` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '国家',
`province` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '',
`city` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '城市',
`isp` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '城市运营商',
`createdAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 0 COMMENT = '题库';
`updatedAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`channel` int NOT NULL DEFAULT 0 COMMENT '来源渠道: 0: 自来, 1: v2ex, 2: 掘金, 3: tools.fun',
`source` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '来源 referrer 字段, 未记录到来源则记录 referrer 用于 数据统计',
`latestAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5471 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '访问数据' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;

0 comments on commit 0d925c1

Please sign in to comment.