v2-project.yaml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v2-project.yaml
  2. get:
  3. summary: 列出工程(project)
  4. tags:
  5. - project
  6. operationId: get_api_v2_project
  7. description: |-
  8. 按 view 指定的口径返回工程列表,支持关键字搜索、状态过滤、排序和分页。
  9. 必须登录,否则返回 401;view 缺失或不在枚举内时返回错误提示 view。
  10. 未传 studio 时,studio 默认取当前用户自己。
  11. 实现:`ProjectController@index`
  12. parameters:
  13. -
  14. name: studio
  15. in: query
  16. schema:
  17. type: string
  18. description: 'studio 名称;不传则使用当前登录用户'
  19. -
  20. name: view
  21. in: query
  22. schema:
  23. type: string
  24. enum:
  25. - studio
  26. - project-tree
  27. - shared
  28. - community
  29. description: '查询口径:studio=某 studio 下的顶层工程,project-tree=某工程及其所有子工程,shared=分享给该 studio 的工程,community=其他 studio 的公开顶层工程'
  30. required: true
  31. -
  32. name: type
  33. in: query
  34. schema:
  35. type: string
  36. enum:
  37. - instance
  38. - article
  39. default: instance
  40. description: '工程类型,用于 studio/shared/community 口径'
  41. -
  42. name: project_id
  43. in: query
  44. schema:
  45. type: string
  46. description: 'view=project-tree 时必填,工程 uid;同时匹配该工程本身及 path 中包含它的子工程'
  47. -
  48. name: keyword
  49. in: query
  50. schema:
  51. type: string
  52. description: 标题模糊搜索关键字
  53. -
  54. name: status
  55. in: query
  56. schema:
  57. type: string
  58. description: 工程状态,逗号分隔可多选
  59. -
  60. name: order
  61. in: query
  62. schema:
  63. type: string
  64. default: id
  65. description: 排序字段
  66. -
  67. name: dir
  68. in: query
  69. schema:
  70. type: string
  71. enum:
  72. - asc
  73. - desc
  74. default: asc
  75. description: 排序方向
  76. -
  77. name: offset
  78. in: query
  79. schema:
  80. type: integer
  81. default: 0
  82. description: 分页偏移量
  83. -
  84. name: limit
  85. in: query
  86. schema:
  87. type: integer
  88. default: 10000
  89. description: 每页条数
  90. -
  91. name: search
  92. in: query
  93. description: 搜索关键字
  94. schema:
  95. type: string
  96. responses:
  97. 200:
  98. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  99. content:
  100. application/json:
  101. schema:
  102. type: object
  103. properties:
  104. ok:
  105. type: boolean
  106. message:
  107. type: string
  108. data:
  109. type: object
  110. properties:
  111. rows:
  112. type: array
  113. items:
  114. type: object
  115. properties: { id: { type: integer }, title: { type: string }, type: { type: integer }, weight: { type: string }, description: { type: string }, executors_id: { type: integer }, parent_id: { type: integer }, parent: { type: string }, path: { type: string }, owner: { type: string }, editor: { type: string }, privacy: { type: string }, created_at: { type: string }, updated_at: { type: string } }
  116. count:
  117. type: integer
  118. 401:
  119. $ref: '../../main.yaml#/components/responses/Unauthorized'
  120. 422:
  121. $ref: '../../main.yaml#/components/responses/ValidationError'
  122. post:
  123. summary: 新建工程
  124. tags:
  125. - project
  126. operationId: post_api_v2_project
  127. description: |-
  128. 在指定 studio 下创建工程。必须登录(否则 401),且当前用户必须是该 studio 本人
  129. (studio_name 解析出的 id 等于当前用户 uid),否则返回 403。
  130. 传入 parent_id 时会读取父工程的 path 并追加父工程 id,写入本工程的 path,
  131. 以便按树查询子工程。
  132. 实现:`ProjectController@store`
  133. requestBody:
  134. required: true
  135. content:
  136. application/json:
  137. schema:
  138. type: object
  139. properties:
  140. studio_name:
  141. type: string
  142. description: 'studio 名称,用于解析归属 studio 并做权限校验'
  143. id:
  144. type: string
  145. description: '工程 uid;为合法 uuid 时用它(已存在则更新该工程),否则服务端生成新 uuid'
  146. title:
  147. type: string
  148. description: 工程标题
  149. description:
  150. type: string
  151. description: 工程描述
  152. parent_id:
  153. type: string
  154. description: '父工程 uid,填写后作为子工程并自动计算 path'
  155. type:
  156. type: string
  157. description: 工程类型
  158. enum:
  159. - instance
  160. - article
  161. default: instance
  162. required:
  163. - studio_name
  164. - title
  165. responses:
  166. 200:
  167. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  168. content:
  169. application/json:
  170. schema:
  171. type: object
  172. properties:
  173. ok:
  174. type: boolean
  175. message:
  176. type: string
  177. data:
  178. type: object
  179. properties:
  180. id:
  181. type: integer
  182. title:
  183. type: string
  184. type:
  185. type: integer
  186. weight:
  187. type: string
  188. description:
  189. type: string
  190. executors_id:
  191. type: integer
  192. parent_id:
  193. type: integer
  194. parent:
  195. type: string
  196. path:
  197. type: string
  198. owner:
  199. type: string
  200. editor:
  201. type: string
  202. privacy:
  203. type: string
  204. created_at:
  205. type: string
  206. updated_at:
  207. type: string
  208. 401:
  209. $ref: '../../main.yaml#/components/responses/Unauthorized'
  210. 422:
  211. $ref: '../../main.yaml#/components/responses/ValidationError'