Skip to main content

Lesson API

學習課程相關的API

Endpoints

# Endpoints


Get categories

獲取課程类别

Request

GET /web/lesson/categories

Response (LessonCategories)

{
"success": true,
"message": "",
"data": [
[
{
"type": 1,
"desc": "復元概念"
},
{
"type": 2,
"desc": "精神健康"
},
{
"type": 3,
"desc": "身體健康"
},
{
"type": 4,
"desc": "與人聯繫"
}
]
]
}

Get lesson

獲取課程

Request

GET /web/lesson/{id}

Response (LessonDTO)

{
"success": true,
"message": "",
"data": [
{
"id": "7212f962-3c12-4dbf-923f-385973926181",
"name": "測試課程",
"categories": [
"復元概念",
"精神健康",
"身體健康",
"與人聯繫"
],
"introduce": "這個課程是測試課程",
"pic": {
"fileKey": "mhahk/lesson/cover/L001/1",
"url": "https://jcci-test-media.aritaone.com/mhahk%2Flesson%2Fcover%2FL001%2F1"
}
}
]
}

Add lesson

增加課程

Request (AddLessonDTO)

POST /web/lesson
{
"id": "7212f962-3c12-4dbf-923f-385973926181",
"name": "測試課程",
"categories": [
1,
2,
3,
4
],
"fileKey": "temp/4c892e63-09c3-4ffb-8665-db34782382e2",
"introduce": "這個課程是測試課程"
}

Response

{
"success": true,
"message": "",
"data": null
}

Put lesson

修改課程

Request (AddLessonDTO)

PUT /web/lesson
{
"id": "7212f962-3c12-4dbf-923f-385973926181",
"name": "測試課程",
"categories": [
1,
2,
3,
4
],
"fileKey": "temp/4c892e63-09c3-4ffb-8665-db34782382e2",
"introduce": "這個課程是測試課程"
}

Response

{
"success": true,
"message": "",
"data": null
}

Delete lesson

刪除課程

Request

DELETE /web/lesson/{id}

Response

{
"success": true,
"message": "",
"data": null
}

update lesson

增加課程

Request (AddLessonDTO)

POST /web/lesson
{
"id": "7212f962-3c12-4dbf-923f-385973926181",
"name": "測試課程",
"categories": [
1,
2,
3,
4
],
"fileKey": "temp/4c892e63-09c3-4ffb-8665-db34782382e2",
"introduce": "這個課程是測試課程"
}

Response

{
"success": true,
"message": "",
"data": null
}

Lesson page

課程列表

Request (LessonFilterReqDTO)

POST /web/lesson/page
{
"status": 1,
"categories": [
1,
2,
3,
4
],
"pagination": {
"page": 1,
"size": 10
},
"sortings": [
{
"direction": "DESC",
"property": "createdAt"
}
]
}

Response (LessonPageRespDTO)

{
"success": true,
"message": "",
"data": {
"pagination": {
"page": 1,
"size": 10,
"totalItems": 1,
"totalPages": 1
},
"sortings": [],
"items": [
{
"id": "7212f962-3c12-4dbf-923f-385973926181",
"name": "測試課程",
"chapterTotal": 0,
"categories": [
"復元概念",
"精神健康",
"身體健康",
"與人聯繫"
],
"status": 1
}
]
}
}

Lesson status

獲取從當前狀態能轉變到的狀態

Request

GET /web/lesson/status/{current-status}

Response (LessonStatus)

{
"success": true,
"message": "",
"data": {
"pagination": {
"page": 1,
"size": 10,
"totalItems": 1,
"totalPages": 1
},
"sortings": [],
"items": [
{
"id": "7212f962-3c12-4dbf-923f-385973926181",
"name": "測試課程",
"chapterTotal": 0,
"categories": [
"復元概念",
"精神健康",
"身體健康",
"與人聯繫"
],
"status": 1
}
]
}
}

Lesson change status

更改審批狀態

Request (LessonChangeStatusReq)

POST /web/lesson/status
{
"id": "91b7ce05-f670-4bd9-98fe-3cd794b147c4",
"status": 1,
"mark": "通過"
}

Response

{
"success": true,
"message": "",
"data": null
}

Lesson batch change status

批量更改審批狀態

Request (LessonBatchChangeStatusReq)

POST /web/lesson/batch-status
{
"ids": [
"91b7ce05-f670-4bd9-98fe-3cd794b147c4"
],
"status": 1,
"mark": "通過"
}

Response

{
"success": true,
"message": "",
"data": null
}

Lesson count

獲取各狀態待審批數量

Request

GET /web/lesson/count

Response (LessonStatusCountResp)

{
"success": true,
"message": "",
"data": [
{
"draftCount": 3,
"secondDraftCount": 0,
"thirdDraftCount": 0,
"readyCount": 0,
"publishCount": 0,
"pullCount": 1
}
]
}

Lesson all simply

所有課程列表

Request

GET /web/lesson/list

Response (LessonSimplyList)

{
"success": true,
"message": "",
"data": [
{
"id": "0a8d8e30-0f1e-4902-ba88-477233a5c23e",
"name": "测试课程1"
},
{
"id": "e2d57b4a-33fd-4f76-b40b-998e65b2a9bf",
"name": "测试2"
}
]
}


Resources

AddLessonDTO

properties
  • id
    String
    required
    課程id, 修改時必填
  • name
    String
    required
    課程名稱,修改時非必填
  • categories
    array[int]
    required
    課程分類,修改時非必填
  • fileKey
    string
    required
    封面圖片fileKey,修改時非必填
  • introduce
    String
    required
    課程簡介,修改時非必填

LessonDTO

properties
  • id
    String
    required
    課程id
  • name
    String
    required
    課程名稱
  • categories
    array[String]
    required
    課程分類
  • fileKey
    string
    required
    封面圖片fileKey
  • url
    string
    required
    fileKey url
  • introduce
    String
    required
    課程簡介

LessonCategories

properties
  • type
    int
    required
    type
  • desc
    string
    required
    desc

LessonFilterReqDTO

properties
  • status
    int
    required
    課程狀態: 1-草稿 2-待主任審批 3-待督導審批 4-未上架 5-已上架 6-已下架
  • categories
    array[int]
    課程狀態: 1:復元概念 2:精神健康 3:身體健康 4:與人聯繫

LessonPageRespDTO

properties
  • id
    string
    required
    課程ID
  • name
    string
    required
    課程名稱
  • chapterTotal
    int
    required
    章節數量
  • categories
    array[string]
    required
    課程分類
  • status
    LessonStatusEnum
    required
    狀態

LessonStatus

properties
  • status
    int
    required
    type
  • desc
    string
    required
    desc

LessonChangeStatusReq

properties
  • id
    int
    required
    課程ID
  • status
    int
    required
    審批狀態
  • mark
    string
    審批註解

LessonBatchChangeStatusReq

properties
  • ids
    array[int]
    required
    課程ID
  • status
    int
    required
    審批狀態
  • mark
    string
    審批註解

LessonStatusCountResp

properties
  • draftCount
    int
    required
    草稿數
  • secondDraftCount
    int
    required
    待主任審批數
  • thirdDraftCount
    int
    required
    待督導審批數
  • readyCount
    int
    required
    待上架數
  • publishCount
    int
    required
    已上架數
  • pullCount
    int
    required
    下架數

LessonSimplyList

properties
  • id
    string
    required
    课程id
  • name
    string
    required
    课程名稱

CategoryEnum

TypeDescription
1家庭關係
2社區生活
3身體健康
4與人連繫

LessonStatusEnum

TypeDescription
1草稿
2待主任審批
3待督導審批
4待上架
5已上架
6已下架