---
# System prepended metadata

title: 主題單元管理

---

# 主題單元管理

[[Schema] 主題單元（CourseUnit）](Untitled%206/Schema%20CourseUnit.csv)

Example:

```json=
    {
        "id": 1,
        "name": "衰弱症復能肌力訓練",
        "description": "改善血液循環，減緩心肌老化速度及肌肉萎縮。",
        "duration": 120,
        "updatedAt": 1578240000000,
        "trainingItems": [2, 10, 3, 12]
    }
```

### (OK)[管理] 查看主題單元列表

Request:

    GET /course/unit?$queryParams

[Query Params:](Untitled%206/Query%20Params.csv)

Response (成功):

```json=
    {
      "success": true,
      "total": "總數量 <number>",
      "data": [
        CourseUnit,
        CourseUnit,
        ...
      ]
    }
```

### (OK)查看主題單元

Request:

    GET /course/unit/$id

Response (成功):

```json=
    {
      "success": true,
      "data": {
          CourseUnit
      } 
    }
```

### (OK)[管理] 新增主題單元

Request:

    POST /course/unit

Payload:

```json=
    {
      CourseUnit
    }
```

Response (成功):

```json=
    {
      "success": true,
      "data": {
          CourseUnit
      }
    }
```

### (OK)[管理] 編輯主題單元

Request:

    PUT /course/unit/$id

Payload:

```json=
    {
      CourseUnit
    }
```

Response (成功):

```json=
    {
      "success": true,
      "data": {
          CourseUnit
      }
    }
```

### (OK)[管理] 移除主題單元

Request:

    DEL /course/unit/$id

Response (成功):

```json=
    {
      "success": true,
      "data": {}
    }
```