Skip to content

Backend

yellow-hank edited this page Apr 28, 2022 · 22 revisions

API Documentation

通用心得

目錄

/api/get/study?from={id}&num={num}&p={queryTerms}&categoryFilter={id1,id2}&statFilter={id1,id2} (取得已審核通用心得)

  • url: /api/get/study?from={id}&num={num}&p={queryTerms}&categoryFilter={id1,id2}&statFilter={id1,id2}&
    • from: 從哪個uuid開始,若為空字串,則預設從最新開始
    • num: 要取得的數量
    • p: 要查詢的字串(會回傳title和content中包含字串的心得)
    • categoryFilter: 要篩選的類別(以逗點分隔)
    • statFilter: 要篩選的統計項目(以逗點分隔)
  • request method : GET
  • header: none
  • body: none
  • Response: 心得排序是依照建立時間從最新到最舊
Name Type Description
data Array 所有通用心得資料
- id Integer 通用心得的 uuid
- title String 心得標題
- content String 心得內文
- year Integer 申請年度
- major String 主修科系
- timestamp UNIX time 心得建立時間
- category Array 此心得所有分類項目
-- id Integer 項目的 uuid
-- name String 分類項目名稱
- statistic Array 此心得所有統計數據資料
-- id Integer 統計數據的 uuid
-- name String 統計數據名稱
-- value String 統計數據數值
- confirm String 審核結果
範例 :
"data": [
        {
            "id": 1,
            "title": "心得1",
            "content": "test",
            "timestamp": 1642662371,
            "category": [
                {
                    "id": 3,
                    "name": "出國交換"
                },
                {
                    "id": 2,
                    "name": "QA"
                }
            ],
            "statistic": [
                {
                    "id": 1,
                    "name": "TOEFL",
                    "value": "110"
                },
                {
                    "id": 2,
                    "name": "GPA4.3",
                    "value": "4.2"
                }
            ]
        },
        {
            "id": 2,
            "title": "心得2",
            "content": "test",
            "timestamp": 1642662371,
            "category": [
                {
                    "id": 4,
                    "name": "實習"
                },
                {
                    "id": 2,
                    "name": "QA"
                }
            ],
            "statistic": [
                {
                    "id": 3,
                    "name": "TOEIC",
                    "value": "700"
                },
                {
                    "id": 3,
                    "name": "GPA4.3",
                    "value": "3.7"
                }
            ]
        }
    ]
}

/api/get/study/all?from={id}&num={num}&p={queryTerms}&categoryFilter={id1,id2}&statFilter={id1,id2} (取得全部通用心得)

  • url: /api/get/study/all?from={id}&num={num}&p={queryTerms}&categoryFilter={id1,id2}&statFilter={id1,id2}
    • from: 從哪個uuid開始,若為空字串,則預設從最新開始
    • num: 要取得的數量
    • p: 要查詢的字串(會回傳title和content中包含字串的心得)
    • categoryFilter: 要篩選的類別(以逗點分隔)
    • statFilter: 要篩選的統計項目(以逗點分隔)
  • request method : GET
  • authorization
  • header: none
  • body: none
  • Response: 心得排序是依照建立時間從最新到最舊
Name Type Description
data Array 所有通用心得資料
- id Integer 通用心得的 uuid
- title String 心得標題
- content String 心得內文
- year Integer 申請年度
- major String 主修科系
- timestamp UNIX time 心得建立時間
- category Array 此心得所有分類項目
-- id Integer 項目的 uuid
-- name String 分類項目名稱
- statistic Array 此心得所有統計數據資料
-- id Integer 統計數據的 uuid
-- name String 統計數據名稱
-- value String 統計數據數值
- confirm String 審核結果

/api/get/study/result?p={queryTerms}&categoryFilter={id1,id2}&statFilter={id1,id2} (取得通用心得的數據結果)

  • url: /api/get/study/result?p={queryTerms}&categoryFilter={id1,id2}&statFilter={id1,id2}
    • p: 要查詢的字串(會統計title和content中包含字串的心得)
    • categoryFilter: 要篩選的類別(以逗點分隔)
    • statFilter: 要篩選的統計項目(以逗點分隔)
  • request method : GET
  • header: none
  • body: none
  • Response: 所有統計項目都會統整,若為字串類型則不統計,數據部分回傳空字串
Name Type Description
id String 統計數據的 uuid
name String 統計數據名稱
average Float 統計數據平均值
min Float or Integer 統計數據最小值
count Integer 幾筆心得

/api/post/study (新增通用心得)

  • url: /api/post/study
  • request method : POST
  • header:
    • Content-Type: application/json
  • body:
Name Type Description
title String 心得標題
content String 心得內文
- year Integer 申請年度
- major String 主修科系
category Array(category) 此心得所有分類項目
- name String 分類項目名稱
statistic Array(statistic) 此心得所有統計數據資料
- name String 統計數據名稱
- value String 統計數據數值
otherStatistic Array(otherStatistic) 此心得其他統計數據資料
- name String 其他統計數據名稱
- value String 其他統計數據數值
  • Response:
    • 成功 : {status:success}
    • 失敗 : {status:fail}

/api/post/study?id={id} (更新某 id 的心得)

  • url: /api/post/study?id={id}
  • request method : PUT
  • authorization
  • header:
    • Content-Type: application/json
  • body:
Name Type Description
title String 心得標題
content String 心得內文
- year Integer 申請年度
- major String 主修科系
category Array(category) 此心得所有分類項目
statistic Array(statistic) 此心得所有統計數據資料
year int 年份
confirm String 審核結果
  • Response:
    • 成功 : {status:success}
    • 失敗 : {status:fail}

/api/patch/study?id={id} (更新某 id 的 confirm)

  • url: /api/patch/study?id={id}
  • request method : PATCH
  • authorization
  • header:
    • Content-Type: application/json
  • body:
Name Type Description
confirm String 審核結果
  • Response:
    • 成功 : {status:success}
    • 失敗 : {status:fail}

/api/delete/study?id={id} (刪除某 id 的心得)

  • url: /api/delete/study?id={id}

  • request method : DELETE

  • authorization

  • header: none

  • body: none

  • Response:

    • 成功 : {status:success}
    • 失敗 : {status:fail}

/api/get/studyType (取得所有分類項目)

  • url: /api/get/studyType
  • request method : GET
  • header: none
  • body: none
  • Response:
Name Type Description
id uuid 分類項目 uuid
name String 分類項目名稱
範例 :
[
    {
        "id": "06a2b364-fbd1-42ac-b678-39f9c00243df",
        "name": "出國交換"
    },
    {
        "id": "5cf7cc11-6c51-40ed-a425-67430eb4ff91",
        "name": "QA"
    }
]

/api/post/studyType (新增分類項目)

  • url: /api/post/studyType
  • request method : POST
  • header:
    • Content-Type: application/json
  • body:
Name Type Description
name String 分類項目名稱
  • Response:
    • 成功 : {status:success, id: {uuid} }
    • 失敗 : {status:fail}

/api/post/studyType?id={id} (更新某 id 的分類項目)

  • url: /api/post/studyType?id={id}
  • request method : PUT
  • authorization
  • header:
    • Content-Type: application/json
  • body:
Name Type Description
name String 分類項目名稱
  • Response:
    • 成功 : {status:success}
    • 失敗 : {status:fail}

/api/delete/studyType?id={id} (刪除某 id 的分類項目)

  • url: /api/delete/studyType?id={id}

  • request method : DELETE

  • authorization

  • header: none

  • body: none

  • Response:

    • 成功 : {status:success}
    • 失敗 : {status:fail}

/api/get/studyStat (取得所有統計資料)

  • url: /api/get/studyStat
  • request method : GET
  • header: none
  • body: none
  • Response:
Name Type Description
id uuid 統計資料 uuid
name String 統計資料名稱
dataType String 資料型態,填入下列選項 (int, float, string)
max 根據 dataType 設定 最大值
min 根據 dataType 設定 最小值
範例 :
[
    {
        "id": "0658c36d-09ee-42c8-85c1-2f1dc890ad62",
        "name": "GPA4.0",
        "dataType": "float",
        "max": 4,
        "min": 0
    },
    {
        "id": "278f2438-ed3a-473d-826e-1f7de67f1908",
        "name": "TOEIC",
        "dataType": "int",
        "max": 990,
        "min": 0
    },
    {
        "id": "ff92939d-0480-431a-81ea-f2b4fd2ec8db",
        "name": "GPA4.3",
        "dataType": "float",
        "max": 4.3,
        "min": 0
    }
]

/api/post/studyStat (新增統計資料)

  • url: /api/post/studyStat
  • request method : POST
  • header:
    • Content-Type: application/json
  • body:
Name Type Description
name String 統計資料名稱
dataType String 資料型態,填入下列選項 (int, float, string)
max 根據 dataType 設定 最大值
min 根據 dataType 設定 最小值
  • Response:
    • 成功 : {status:success, id: {uuid} }
    • 失敗 : {status:fail}

/api/post/studyStat?id={id} (更新某 id 的統計資料)

  • url: /api/post/studyStat?id={id}
  • request method : PUT
  • authorization
  • header:
    • Content-Type: application/json
  • body:
Name Type Description
name String 統計資料名稱
max 根據 dataType 設定 最大值
min 根據 dataType 設定 最小值
  • 不接受更改 dataType

  • Response:

    • 成功 : {status:success}
    • 失敗 : {status:fail}

/api/delete/studyStat?id={id} (刪除某 id 的統計資料)

  • url: /api/delete/studyStat?id={id}

  • request method : DELETE

  • authorization

  • header: none

  • body: none

  • Response:

    • 成功 : {status:success}
    • 失敗 : {status:fail}

/api/get/otherStat (取得所有其他統計資料)

  • url: /api/get/otherStat
  • request method : GET
  • authorization
  • header: none
  • body: none
  • Response:
Name Type Description
id uuid 其他統計資料 uuid
name String 其他統計資料名稱
value String 其他統計資料結果
study_id uuid 連結 study 的 uuid

/api/post/transformStudyStat?id={id} (轉換某 id 的其他統計資料到現有的統計資料中)

  • url: /api/post/transformStudyStat
  • request method : POST
  • authorization
  • header:
    • Content-Type: application/json
  • body:
Name Type Description
transformStudyStat String 轉換之後統計資料名稱