v2-task.yaml 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v2-task.yaml
  2. get:
  3. summary: 列出任务
  4. tags:
  5. - task
  6. operationId: get_api_v2_task
  7. description: |-
  8. 按 view 指定的口径返回任务列表,支持按执行人、责任人(指派)、参与者、
  9. 关键字、状态过滤,并支持排序与分页。必须登录,未登录返回 401。
  10. 注意:view 取值不在枚举内时不会构造查询,会导致请求失败。
  11. 实现:`TaskController@index`
  12. parameters:
  13. -
  14. name: view
  15. in: query
  16. schema:
  17. type: string
  18. enum:
  19. - all
  20. - instance
  21. - studio
  22. - project
  23. description: 查询口径:all=全部有归属的任务,instance=实例任务(type=instance),studio=当前用户名下(owner_id=当前用户)的任务,project=某工程及其子工程下的任务
  24. required: true
  25. -
  26. name: project_id
  27. in: query
  28. schema:
  29. type: string
  30. description: 'view=project 时必填,工程 uid;同时匹配该工程本身及 path 中包含它的子工程'
  31. -
  32. name: executor_id_includes
  33. in: query
  34. schema:
  35. type: string
  36. description: '实际执行人 uid,逗号分隔,只返回执行人在其中的任务'
  37. -
  38. name: executor_id_not-includes
  39. in: query
  40. schema:
  41. type: string
  42. description: '实际执行人 uid,逗号分隔,排除执行人在其中的任务'
  43. -
  44. name: assignees_id_includes
  45. in: query
  46. schema:
  47. type: string
  48. description: 责任人(指派人)uid,逗号分隔,只返回指派给其中任一人的任务
  49. -
  50. name: assignees_id_not-includes
  51. in: query
  52. schema:
  53. type: string
  54. description: 责任人(指派人)uid,逗号分隔,排除指派给其中任一人的任务
  55. -
  56. name: assignees_id_null
  57. in: query
  58. schema:
  59. type: string
  60. description: 传该参数(任意值)表示只返回没有任何责任人的任务
  61. -
  62. name: assignees_id_not-null
  63. in: query
  64. schema:
  65. type: string
  66. description: 传该参数(任意值)表示只返回至少有一个责任人的任务
  67. -
  68. name: sign_up_equals
  69. in: query
  70. schema:
  71. type: string
  72. enum:
  73. - 'true'
  74. - 'false'
  75. description: '值为 true 时只返回可领取的任务,即责任人和实际执行人都为空'
  76. -
  77. name: participants_id_includes
  78. in: query
  79. schema:
  80. type: string
  81. description: '参与者 uid,逗号分隔,实际执行人或责任人命中其一即返回'
  82. -
  83. name: participants_id_not-includes
  84. in: query
  85. schema:
  86. type: string
  87. description: '参与者 uid,逗号分隔,排除这些人参与的任务'
  88. -
  89. name: keyword
  90. in: query
  91. schema:
  92. type: string
  93. description: 标题模糊搜索关键字
  94. -
  95. name: status
  96. in: query
  97. schema:
  98. type: string
  99. description: '任务状态,逗号分隔可多选;传 all 表示不过滤。数据库默认值为 pending'
  100. -
  101. name: order
  102. in: query
  103. schema:
  104. type: string
  105. default: created_at
  106. description: 排序字段
  107. -
  108. name: dir
  109. in: query
  110. schema:
  111. type: string
  112. enum:
  113. - asc
  114. - desc
  115. default: asc
  116. description: 排序方向
  117. -
  118. name: offset
  119. in: query
  120. schema:
  121. type: integer
  122. default: 0
  123. description: 分页偏移量
  124. -
  125. name: limit
  126. in: query
  127. schema:
  128. type: integer
  129. default: 1000
  130. description: 每页条数
  131. -
  132. name: search
  133. in: query
  134. description: 搜索关键字
  135. schema:
  136. type: string
  137. responses:
  138. 200:
  139. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  140. content:
  141. application/json:
  142. schema:
  143. type: object
  144. properties:
  145. ok:
  146. type: boolean
  147. message:
  148. type: string
  149. data:
  150. type: object
  151. properties:
  152. rows:
  153. type: array
  154. items:
  155. type: object
  156. properties: { mode: { type: string }, format: { type: string }, footnote: { type: string }, origin: { type: string }, paragraph: { type: string }, id: { type: integer }, title: { type: string }, description: { type: string }, type: { type: integer }, category: { type: string }, progress: { type: integer }, parent_id: { type: integer }, parent: { type: string }, roles: { type: string }, executor_id: { type: integer }, executor_relation_task_id: { type: integer }, executor_relation_task: { type: string }, pre_task: { type: string }, next_task: { type: string }, is_milestone: { type: boolean }, project_id: { type: integer }, project: { type: string }, owner_id: { type: integer }, owner: { type: string }, editor_id: { type: integer }, editor: { type: string }, order: { type: string }, status: { type: integer }, created_at: { type: string }, updated_at: { type: string }, started_at: { type: string }, finished_at: { type: string }, assignees_id: { type: integer }, assignees: { type: string }, html: { type: string }, executor: { type: string } }
  157. count:
  158. type: integer
  159. 401:
  160. $ref: '../../main.yaml#/components/responses/Unauthorized'
  161. 422:
  162. $ref: '../../main.yaml#/components/responses/ValidationError'
  163. post:
  164. summary: 新建任务
  165. tags:
  166. - task
  167. operationId: post_api_v2_task
  168. description: |-
  169. 在指定 studio 下创建任务。必须登录(否则 401),且当前用户必须是该 studio 本人
  170. (studio_name 解析出的 id 等于当前用户 uid),否则返回 403。
  171. 新任务的 order 自动取同一 parent(无 parent 时取同一 project)下最大 order + 1,
  172. 没有兄弟节点时为 1;owner_id 为该 studio,creator_id 与 editor_id 为当前用户。
  173. 实现:`TaskController@store`
  174. requestBody:
  175. required: true
  176. content:
  177. application/json:
  178. schema:
  179. type: object
  180. properties:
  181. studio_name:
  182. type: string
  183. description: 'studio 名称,用于解析归属 studio 并做权限校验'
  184. id:
  185. type: string
  186. description: '任务 uuid;为合法 uuid 时用它,否则服务端生成新 uuid'
  187. project_id:
  188. type: string
  189. description: '所属工程 uid'
  190. title:
  191. type: string
  192. description: 任务标题
  193. parent_id:
  194. type: string
  195. description: '父任务 uuid,填写后为子任务'
  196. type:
  197. type: string
  198. description: 任务类型
  199. default: project
  200. required:
  201. - studio_name
  202. - title
  203. responses:
  204. 200:
  205. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  206. content:
  207. application/json:
  208. schema:
  209. type: object
  210. properties:
  211. ok:
  212. type: boolean
  213. message:
  214. type: string
  215. data:
  216. type: object
  217. properties:
  218. mode:
  219. type: string
  220. format:
  221. type: string
  222. footnote:
  223. type: string
  224. origin:
  225. type: string
  226. paragraph:
  227. type: string
  228. id:
  229. type: integer
  230. title:
  231. type: string
  232. description:
  233. type: string
  234. type:
  235. type: integer
  236. category:
  237. type: string
  238. progress:
  239. type: integer
  240. parent_id:
  241. type: integer
  242. parent:
  243. type: string
  244. roles:
  245. type: string
  246. executor_id:
  247. type: integer
  248. executor_relation_task_id:
  249. type: integer
  250. executor_relation_task:
  251. type: string
  252. pre_task:
  253. type: string
  254. next_task:
  255. type: string
  256. is_milestone:
  257. type: boolean
  258. project_id:
  259. type: integer
  260. project:
  261. type: string
  262. owner_id:
  263. type: integer
  264. owner:
  265. type: string
  266. editor_id:
  267. type: integer
  268. editor:
  269. type: string
  270. order:
  271. type: string
  272. status:
  273. type: integer
  274. created_at:
  275. type: string
  276. updated_at:
  277. type: string
  278. started_at:
  279. type: string
  280. finished_at:
  281. type: string
  282. assignees_id:
  283. type: integer
  284. assignees:
  285. type: string
  286. html:
  287. type: string
  288. executor:
  289. type: string
  290. 401:
  291. $ref: '../../main.yaml#/components/responses/Unauthorized'
  292. 422:
  293. $ref: '../../main.yaml#/components/responses/ValidationError'