Browse Source

feat: 新增项目详细的swagger

lanjianrong 4 năm trước cách đây
mục cha
commit
e5efc0ff77
5 tập tin đã thay đổi với 279 bổ sung28 xóa
  1. 0 1
      .gitignore
  2. 3 3
      web/api/rule_api.go
  3. 104 8
      web/docs/docs.go
  4. 104 8
      web/docs/swagger.json
  5. 68 8
      web/docs/swagger.yaml

+ 0 - 1
.gitignore

@@ -2,4 +2,3 @@
 /web/web.exe
 /go.sum
 /go.mod
-docs

+ 3 - 3
web/api/rule_api.go

@@ -28,7 +28,7 @@ type RuleApi struct {
 // @Security ApiKeyAuth
 // @Param   bidsectionId     path    string     true        "标段ID"
 // @Param   projectId     path    string     true        "项目ID"
-// @Success 200 {object} viewmodels.ViewRule "{code:0成功,data:viewmodels.Safe,msg:}"
+// @Success 200 {object} viewmodels.ViewRule "{code:0成功,data:viewmodels.Safe,msg:请求成功}"
 // @Failure 400 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Router /api/rule [get]
 func (c *RuleApi) Get() {
@@ -67,7 +67,7 @@ func (c *RuleApi) Get() {
 // @Param   bidsectionId     body    string     true        "标段ID"
 // @Param   type 			body     string  true   "规则类型" eg:"safeRule、qualityRule、contractRule"
 // @Param   value 			body     string  true   "编号规则" eg:"'['202011', 'cc3']'"
-// @Success 200 {object} "{code:0成功,msg:}"
+// @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Failure 400 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Router /api/rule [post]
 func (c *RuleApi) Post() {
@@ -110,7 +110,7 @@ func (c *RuleApi) Post() {
 // @Security ApiKeyAuth
 // @Param   bidsectionId     body    string     true        "标段ID"
 // @Param   type 			body     string  true   "规则类型" eg:"safeRule、qualityRule、contractRule"
-// @Success 200 {object}  "{code:0成功,data:"",msg:""}"
+// @Success 200 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Failure 400 {string} string	"{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}"
 // @Router /api/rule/auto [post]
 func (c *RuleApi) PostAuto() {

+ 104 - 8
web/docs/docs.go

@@ -1549,6 +1549,34 @@ var doc = `{
                 }
             }
         },
+        "/api/projectSetting/project": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "description": "获取项目信息",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "项目设置-管理员"
+                ],
+                "summary": "获取项目信息",
+                "responses": {
+                    "200": {
+                        "description": "{code:0成功,-1参数类错误,data:viewmodels.ProjectAccount,msg:错误信息}",
+                        "schema": {
+                            "type": "string"
+                        }
+                    }
+                }
+            }
+        },
         "/api/projectSetting/project/save": {
             "post": {
                 "security": [
@@ -1632,9 +1660,9 @@ var doc = `{
                 ],
                 "responses": {
                     "200": {
-                        "description": "{code:0成功,data:viewmodels.Safe,msg:}",
+                        "description": "{code:0成功,data:viewmodels.Safe,msg:请求成功}",
                         "schema": {
-                            "$ref": "#/definitions/viewmodels.Safe"
+                            "$ref": "#/definitions/viewmodels.ViewRule"
                         }
                     },
                     "400": {
@@ -1661,7 +1689,7 @@ var doc = `{
                 "tags": [
                     "编号规则"
                 ],
-                "summary": "提交规则",
+                "summary": "提交编号规则",
                 "parameters": [
                     {
                         "description": "标段ID",
@@ -1693,9 +1721,63 @@ var doc = `{
                 ],
                 "responses": {
                     "200": {
-                        "description": "{code:0成功,data:viewmodels.Safe,msg:}",
+                        "description": "{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}",
                         "schema": {
-                            "$ref": "#/definitions/viewmodels.Safe"
+                            "type": "string"
+                        }
+                    },
+                    "400": {
+                        "description": "{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}",
+                        "schema": {
+                            "type": "string"
+                        }
+                    }
+                }
+            }
+        },
+        "/api/rule/auto": {
+            "post": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "description": "提交规则",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "编号规则"
+                ],
+                "summary": "生成编号",
+                "parameters": [
+                    {
+                        "description": "标段ID",
+                        "name": "bidsectionId",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "type": "string"
+                        }
+                    },
+                    {
+                        "description": "规则类型",
+                        "name": "type",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "type": "string"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}",
+                        "schema": {
+                            "type": "string"
                         }
                     },
                     "400": {
@@ -1765,7 +1847,7 @@ var doc = `{
                 "tags": [
                     "安全巡检"
                 ],
-                "summary": "安全巡检列表",
+                "summary": "创建新的安全巡检记录",
                 "parameters": [
                     {
                         "description": "标段ID",
@@ -1844,7 +1926,7 @@ var doc = `{
                 "tags": [
                     "安全巡检"
                 ],
-                "summary": "安全巡检列表",
+                "summary": "删除记录",
                 "parameters": [
                     {
                         "description": "安全巡检ID",
@@ -1889,7 +1971,7 @@ var doc = `{
                 "tags": [
                     "安全巡检"
                 ],
-                "summary": "安全巡检列表",
+                "summary": "获取安全巡检详情",
                 "parameters": [
                     {
                         "type": "string",
@@ -2455,6 +2537,20 @@ var doc = `{
                     "type": "integer"
                 }
             }
+        },
+        "viewmodels.ViewRule": {
+            "type": "object",
+            "properties": {
+                "contractRule": {
+                    "type": "string"
+                },
+                "qualityRule": {
+                    "type": "string"
+                },
+                "safeRule": {
+                    "type": "string"
+                }
+            }
         }
     },
     "securityDefinitions": {

+ 104 - 8
web/docs/swagger.json

@@ -1532,6 +1532,34 @@
                 }
             }
         },
+        "/api/projectSetting/project": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "description": "获取项目信息",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "项目设置-管理员"
+                ],
+                "summary": "获取项目信息",
+                "responses": {
+                    "200": {
+                        "description": "{code:0成功,-1参数类错误,data:viewmodels.ProjectAccount,msg:错误信息}",
+                        "schema": {
+                            "type": "string"
+                        }
+                    }
+                }
+            }
+        },
         "/api/projectSetting/project/save": {
             "post": {
                 "security": [
@@ -1615,9 +1643,9 @@
                 ],
                 "responses": {
                     "200": {
-                        "description": "{code:0成功,data:viewmodels.Safe,msg:}",
+                        "description": "{code:0成功,data:viewmodels.Safe,msg:请求成功}",
                         "schema": {
-                            "$ref": "#/definitions/viewmodels.Safe"
+                            "$ref": "#/definitions/viewmodels.ViewRule"
                         }
                     },
                     "400": {
@@ -1644,7 +1672,7 @@
                 "tags": [
                     "编号规则"
                 ],
-                "summary": "提交规则",
+                "summary": "提交编号规则",
                 "parameters": [
                     {
                         "description": "标段ID",
@@ -1676,9 +1704,63 @@
                 ],
                 "responses": {
                     "200": {
-                        "description": "{code:0成功,data:viewmodels.Safe,msg:}",
+                        "description": "{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}",
                         "schema": {
-                            "$ref": "#/definitions/viewmodels.Safe"
+                            "type": "string"
+                        }
+                    },
+                    "400": {
+                        "description": "{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}",
+                        "schema": {
+                            "type": "string"
+                        }
+                    }
+                }
+            }
+        },
+        "/api/rule/auto": {
+            "post": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "description": "提交规则",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "编号规则"
+                ],
+                "summary": "生成编号",
+                "parameters": [
+                    {
+                        "description": "标段ID",
+                        "name": "bidsectionId",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "type": "string"
+                        }
+                    },
+                    {
+                        "description": "规则类型",
+                        "name": "type",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "type": "string"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}",
+                        "schema": {
+                            "type": "string"
                         }
                     },
                     "400": {
@@ -1748,7 +1830,7 @@
                 "tags": [
                     "安全巡检"
                 ],
-                "summary": "安全巡检列表",
+                "summary": "创建新的安全巡检记录",
                 "parameters": [
                     {
                         "description": "标段ID",
@@ -1827,7 +1909,7 @@
                 "tags": [
                     "安全巡检"
                 ],
-                "summary": "安全巡检列表",
+                "summary": "删除记录",
                 "parameters": [
                     {
                         "description": "安全巡检ID",
@@ -1872,7 +1954,7 @@
                 "tags": [
                     "安全巡检"
                 ],
-                "summary": "安全巡检列表",
+                "summary": "获取安全巡检详情",
                 "parameters": [
                     {
                         "type": "string",
@@ -2438,6 +2520,20 @@
                     "type": "integer"
                 }
             }
+        },
+        "viewmodels.ViewRule": {
+            "type": "object",
+            "properties": {
+                "contractRule": {
+                    "type": "string"
+                },
+                "qualityRule": {
+                    "type": "string"
+                },
+                "safeRule": {
+                    "type": "string"
+                }
+            }
         }
     },
     "securityDefinitions": {

+ 68 - 8
web/docs/swagger.yaml

@@ -208,6 +208,15 @@ definitions:
       templateNumber:
         type: integer
     type: object
+  viewmodels.ViewRule:
+    properties:
+      contractRule:
+        type: string
+      qualityRule:
+        type: string
+      safeRule:
+        type: string
+    type: object
 info:
   contact:
     name: CP Support
@@ -1187,6 +1196,23 @@ paths:
       summary: 标段中添加成员-账号
       tags:
       - 项目设置-标段成员权限-管理员
+  /api/projectSetting/project:
+    get:
+      consumes:
+      - application/json
+      description: 获取项目信息
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: '{code:0成功,-1参数类错误,data:viewmodels.ProjectAccount,msg:错误信息}'
+          schema:
+            type: string
+      security:
+      - ApiKeyAuth: []
+      summary: 获取项目信息
+      tags:
+      - 项目设置-管理员
   /api/projectSetting/project/save:
     post:
       consumes:
@@ -1237,9 +1263,9 @@ paths:
       - application/json
       responses:
         "200":
-          description: '{code:0成功,data:viewmodels.Safe,msg:}'
+          description: '{code:0成功,data:viewmodels.Safe,msg:请求成功}'
           schema:
-            $ref: '#/definitions/viewmodels.Safe'
+            $ref: '#/definitions/viewmodels.ViewRule'
         "400":
           description: '{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}'
           schema:
@@ -1276,16 +1302,50 @@ paths:
       - application/json
       responses:
         "200":
-          description: '{code:0成功,data:viewmodels.Safe,msg:}'
+          description: '{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}'
           schema:
-            $ref: '#/definitions/viewmodels.Safe'
+            type: string
+        "400":
+          description: '{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}'
+          schema:
+            type: string
+      security:
+      - ApiKeyAuth: []
+      summary: 提交编号规则
+      tags:
+      - 编号规则
+  /api/rule/auto:
+    post:
+      consumes:
+      - application/json
+      description: 提交规则
+      parameters:
+      - description: 标段ID
+        in: body
+        name: bidsectionId
+        required: true
+        schema:
+          type: string
+      - description: 规则类型
+        in: body
+        name: type
+        required: true
+        schema:
+          type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: '{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}'
+          schema:
+            type: string
         "400":
           description: '{code:0成功,-1参数类错误,-2服务端内部错误,msg:错误信息}'
           schema:
             type: string
       security:
       - ApiKeyAuth: []
-      summary: 提交规则
+      summary: 生成编号
       tags:
       - 编号规则
   /api/safe:
@@ -1313,7 +1373,7 @@ paths:
             type: string
       security:
       - ApiKeyAuth: []
-      summary: 安全巡检列表
+      summary: 删除记录
       tags:
       - 安全巡检
     get:
@@ -1390,7 +1450,7 @@ paths:
             type: string
       security:
       - ApiKeyAuth: []
-      summary: 安全巡检列表
+      summary: 创建新的安全巡检记录
       tags:
       - 安全巡检
   /api/safe/detail:
@@ -1417,7 +1477,7 @@ paths:
             type: string
       security:
       - ApiKeyAuth: []
-      summary: 安全巡检列表
+      summary: 获取安全巡检详情
       tags:
       - 安全巡检
   /api/tree: