瀏覽代碼

[修改]题目前缀为question [新增] 题目类型设计

soleil 7 年之前
父節點
當前提交
bb9e1217a7

+ 5 - 5
assignment/serializer/AssignmentType.md

@@ -7,19 +7,19 @@
 枚举值:
 ```
 {
-	"name":"CODE", 
+	"name":"CODE",
 	"value":"团队代码作业"
 }
 {
-	"name":"DOCUMENT", 
+	"name":"DOCUMENT",
 	"value":"文档作业"
 }
 {
-	"name":"REVIEW", 
+	"name":"REVIEW",
 	"value":"互评作业"
 }
 {
-	"name":"ML", 
+	"name":"ML",
 	"value":"机器学习作业"
 }
-```
+```

+ 2 - 1
prefix.md

@@ -7,6 +7,7 @@
 | 吴新宇 | 创建     | 2018/12/18 |
 | 周玮璐 | 新增题目前缀     | 2018/12/20 |
 | 周玮璐 | 新增考试&&考试结果&&考试提交记录&&运行记录前缀     | 2018/12/22 |
+| 周玮璐 | 更改题目前缀为question     | 2018/12/25 |
 
 ## 前缀列表
 
@@ -14,7 +15,7 @@
 - [group](course/api/Group-小组.md)
 - [auth](user/api/Auth-权限.md)
 - [user](user/api/User-用户.md)
-- [problem](problem/api/Problem-题目.md)
+- [question](question/api/Question-题目.md)
 - [exam](exam/api/Exam-考试.md)
 - [result](exam/api/Result-考试结果.md)
 - [commit](exam/api/Commit-提交记录.md)

+ 10 - 0
question/README.md

@@ -0,0 +1,10 @@
+### 负责人
+
+- 【后端】曹姝玥
+- 【前端】周玮璐
+
+### 修改记录
+
+| 修改人 | 修改内容  | 修改时间   |
+| ------ | --------- | ---------- |
+| 周玮璐 | 初始化api | 2018/12/19 |

+ 234 - 0
question/api/Question-题目.md

@@ -0,0 +1,234 @@
+# Problem - 题目
+
+> url 前缀:**question**
+>
+> 示例:**https://xxxxxxxxx/api/question/xxxx**
+
+## 获取全部题目分类
+
+[TEACHER]
+
+```http
+get /teacher/questionType
+```
+
+### Response
+
+```json
+{
+  "data": Array<QuestionTypeSerializer>
+}
+```
+see [QuestionTypeSerializer](../serializer/QuestionTypeSerializer.md)
+
+## 按题目分类获得题目(分页)
+
+[TEACHER]
+
+```http
+get /teacher/questions
+```
+
+### Parameters
+
+| Name     | Type   | Description      |
+| -------- | ------ | ---------------- |
+| type | String | 题目类型 |
+| page | number | 当前页数 |
+| limit | number | 每页的题目数量 |
+
+
+### Response
+
+```json
+{
+  "data": Array<QuestionSerializer>,
+  "pageNum": number,
+}
+```
+- pageNum: 总页数
+
+see [QuestionSerializer](../serializer/QuestionSerializer.md)
+
+### Error
+
+```json
+{
+  "code": 400,
+  "message": "当前页码超过总页数",
+}
+```
+
+## 根据作业类型获得题目(分页)
+
+[TEACHER]
+
+```http
+get /teacher/questions
+```
+
+### Parameters
+
+| Name     | Type   | Description      |
+| -------- | ------ | ---------------- |
+| assignmenttype | String | 作业类型|
+| page | number | 当前页数 |
+| limit | number | 每页的题目数量 |
+
+### Response
+
+```json
+{
+  "data": Array<QuestionSerializer>,
+  "pageNum": number,
+}
+```
+- pageNum: 总页数
+
+see [QuestionSerializer](../serializer/QuestionSerializer.md)
+
+### Error
+
+```json
+{
+  "code": 400,
+  "message": "当前页码超过总页数",
+}
+```
+
+## 根据关键字进行模糊查找
+
+[TEACHER]
+
+```http
+get /teacher/keyword
+```
+
+### Parameters
+
+| Name     | Type   | Description      |
+| -------- | ------ | ---------------- |
+| keyword | String | 用户查找关键字 |
+
+### Response
+
+```json
+{
+  "data": Array<QuestionSerializer>
+}
+```
+
+see [QuestionSerializer](../serializer/QuestionSerializer.md)
+
+## 根据题目ID查看单个题目
+
+```http
+get /question/:questionId
+```
+
+### Response
+
+```json
+{
+  "data": QuestionSerializer,
+}
+```
+see [QuestionSerializer](../serializer/QuestionSerializer.md)
+
+
+***
+## 以下为二期开发内容
+
+## 上传单个题目
+
+[TEACHER]
+
+```http
+post /teacher/question
+```
+### Parameters
+
+```json
+{
+  "data": QuestionSerializer,
+}  
+```
+
+### Response
+
+```json
+{
+  "msg": string,
+  "id": number,
+}
+```
+### Error
+
+```json
+{
+  "code": 400,
+  "message": "题目名称不能重复",
+}
+```
+
+see [QuestionSerializer](../serializer/QuestionSerializer.md)
+
+## 更新题目
+
+[TEACHER]
+
+```http
+put /teacher/question
+```
+
+###Parameters
+
+```json
+{
+  "data": QuestionSerializer,
+}  
+```
+
+###Response
+
+```json
+{
+  "msg": string,
+}
+```
+
+see [QuestionSerializer](../serializer/QuestionSerializer.md)
+
+## 删除题目
+
+[TEACHER]
+
+```http
+delete /teacher/questionDelete
+```
+
+### Parameters
+
+| Name     | Type   | Description      |
+| -------- | ------ | ---------------- |
+| questionId | number | 题目ID |
+
+###Response
+
+```json
+{
+  "msg": string,
+}
+```
+
+
+## 更新文件(待定)
+
+[TEACHER]
+
+```http
+put /teacher/fileUpdate
+```
+
+
+see [FileSerializer](../serializer/FileSerializer.md)

+ 9 - 0
question/serializer/FileSerializer.md

@@ -0,0 +1,9 @@
+# FileSerializer
+
+文件的基本信息
+
+## Attributes
+- filename: **String** - 文件名 | `{2-100}`
+- content:  **Array<String>** -  文件内容
+- size: **number** -  文件大小 | `[0-9]*`
+- uploader: **number**, 上传者ID  

+ 16 - 0
question/serializer/QuestionSerializer.md

@@ -0,0 +1,16 @@
+# QuestionSerializer
+
+题目的基本信息
+
+## Attributes
+- AssignmentType : **String** - 题目所属作业类型 | `{1-10}`
+- type: **String** - 题目类型 | `{1-10}`
+- name: **String** - 题目名称 | `{2-100}`
+- description: **String** - 题目描述
+- creator: **number** - 创建者ID
+- expectTime: **number** - 预计完成时间 `[0-9]{1-3}`
+- difficulty: **number** - 题目难度 `[0-9]`
+- file:
+[**FileSerializer**](./FileSerializer.md) - 文件信息
+
+<!-- TBD:题目难度、预计完成时间数据类型 -->

+ 26 - 0
question/serializer/QuestionTypeSerializer.md

@@ -0,0 +1,26 @@
+# QuestionType
+
+- 题目类型
+- 属性:
+	- name:类型名,String
+	- value:类型值,String
+
+枚举值:
+```
+{
+	"name":"JAVA",
+	"value":"JAVA语言"
+}
+{
+	"name":"C",
+	"value":"C语言"
+}
+{
+	"name":"C++",
+	"value":"C++语言"
+}
+{
+	"name":"Python",
+	"value":"Python语言"
+}
+```