Bladeren bron

Merge pull request #1775 from visuddhinanda/agile

add corpus to openapi
visuddhinanda 2 jaren geleden
bovenliggende
commit
fcfcf40f25

+ 3 - 1
dashboard/src/components/template/ParaShell.tsx

@@ -59,7 +59,9 @@ const ParaShellCtl = ({
           position: "absolute",
           position: "absolute",
           marginTop: "-2em",
           marginTop: "-2em",
           marginLeft: "1em",
           marginLeft: "1em",
-          backgroundColor: "#d9e9ff",
+          border: isFocus
+            ? "2px solid #e35f00bd "
+            : "2px solid rgba(0, 107, 255, 0.3)",
           borderRadius: "4px",
           borderRadius: "4px",
         }}
         }}
       >
       >

+ 2 - 0
openapi/public/assets/protocol/main.yaml

@@ -33,3 +33,5 @@ paths:
     $ref: "./resources/progress/index.yaml"
     $ref: "./resources/progress/index.yaml"
   /sentence:
   /sentence:
     $ref: "./resources/sentence/index.yaml"
     $ref: "./resources/sentence/index.yaml"
+  /corpus:
+    $ref: "./resources/corpus/corpus/index.yaml"

+ 51 - 0
openapi/public/assets/protocol/resources/corpus/corpus/data.yaml

@@ -0,0 +1,51 @@
+properties:
+  uid:
+    type: string
+  title:
+    type: string
+  title_text:
+    type: string
+  subtitle:
+    type: string
+  summary:
+    type: string
+  _summary:
+    type: string
+  content:
+    type: string
+  content_type:
+    type: string
+  html:
+    type: string
+  path:
+    type: object
+    properties:
+      key:
+        type: string
+      book:
+        type: number
+      paragraph:
+        type: number
+      title:
+        type: string
+      paliTitle:
+        type: string
+      level:
+        type: number
+  studio:
+    type: object
+    properties:
+      id:
+        type: string
+      nickName:
+        type: string
+      studioName:
+        type: string
+      realName:
+        type: string
+      avatar:
+        type: string
+  created_at:
+    type: string
+  updated_at:
+    type: string

+ 69 - 0
openapi/public/assets/protocol/resources/corpus/corpus/index.yaml

@@ -0,0 +1,69 @@
+get:
+  summary: 返回段落信息,包含原文,译文
+  tags:
+    - corpus
+  description: 支持查询多个段落。
+  parameters:
+    - name: view
+      in: query
+      required: true
+      description: 查询什么内容,目前仅支持para 段落查询
+      schema:
+        type: string
+        enum:
+          - para
+    - name: mode
+      in: query
+      required: false
+      description: 返回数据模式。阅读模式巴利原文是markdown数据,编辑模式是json逐词解析数据。
+      schema:
+        type: string
+        enum:
+          - read
+          - edit
+          - wbw
+    - name: channels
+      in: query
+      required: false
+      description: channel id列表。两个channel 之间用下划线_连接。没有channel仅返回巴利原文。
+      schema:
+        type: string
+    - name: book
+      in: query
+      required: true
+      description: 书号 1~217
+      schema:
+        type: number
+    - name: par
+      in: query
+      required: true
+      description: 段落号,两个段落之间用英文逗号连接
+      schema:
+        type: string
+    - name: format
+      in: query
+      required: false
+      description: 返回数据格式 默认react
+      schema:
+        type: string
+        enum:
+          - react
+          - unity
+          - html
+          - tex
+          - text
+  responses:
+    "200": # status code
+      description: A JSON array of user names
+      content:
+        application/json:
+          schema:
+            type: object
+            properties:
+              ok:
+                type: boolean
+              message:
+                type: string
+              data:
+                type: object
+                $ref: "./data.yaml"

+ 1 - 1
openapi/public/assets/protocol/resources/corpus/pali-text/index.yaml

@@ -1,7 +1,7 @@
 get:
 get:
   summary: Returns a list of users.
   summary: Returns a list of users.
   tags:
   tags:
-    - corpus
+    - pali-text
   responses:
   responses:
     "200":
     "200":
       description: A JSON array of user names
       description: A JSON array of user names

+ 7 - 5
openapi/public/assets/protocol/resources/progress/index.yaml

@@ -1,5 +1,5 @@
 get:
 get:
-  summary: Returns a list of discussions.
+  summary: 返回已有译文的章节信息
   tags:
   tags:
     - progress
     - progress
   description: 返回多行数据。支持关键字搜索,分页,排序
   description: 返回多行数据。支持关键字搜索,分页,排序
@@ -15,13 +15,13 @@ get:
     - name: tags
     - name: tags
       in: query
       in: query
       required: false
       required: false
-      description: 便签过滤
+      description: 标签过滤。空为全部标签。
       schema:
       schema:
         type: string
         type: string
     - name: studio
     - name: studio
       in: query
       in: query
       required: false
       required: false
-      description: studio过滤
+      description: studio选择。默认选择全部studio
       schema:
       schema:
         type: string
         type: string
     - name: progress
     - name: progress
@@ -57,14 +57,14 @@ get:
           - commentary
           - commentary
     - name: limit
     - name: limit
       in: query
       in: query
-      description: 每次提取记录数
+      description: 每次提取记录数,默认20
       schema:
       schema:
         type: number
         type: number
         minimum: 1
         minimum: 1
         maximum: 1000
         maximum: 1000
     - name: offset
     - name: offset
       in: query
       in: query
-      description: 从第几条记录开始提取
+      description: 从第几条记录开始提取,默认值0
       schema:
       schema:
         type: number
         type: number
   responses:
   responses:
@@ -79,4 +79,6 @@ get:
                 type: boolean
                 type: boolean
               message:
               message:
                 type: string
                 type: string
+              data:
+                type: object
                 $ref: "./data.yaml"
                 $ref: "./data.yaml"