v2-task-task.yaml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v2-task-task.yaml
  2. get:
  3. summary: 查看单个任务
  4. tags:
  5. - task
  6. operationId: get_api_v2_task_task_
  7. description: |-
  8. 通过路由模型绑定按任务 uuid 取出任务并返回详情,任务不存在时返回 404。
  9. 该接口不做登录与权限校验,任何人都能读取。
  10. 实现:`TaskController@show`
  11. parameters:
  12. -
  13. name: task
  14. in: path
  15. required: true
  16. schema:
  17. type: string
  18. description: '任务 uuid'
  19. responses:
  20. 200:
  21. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  22. content:
  23. application/json:
  24. schema:
  25. type: object
  26. properties:
  27. ok:
  28. type: boolean
  29. message:
  30. type: string
  31. data:
  32. type: object
  33. properties:
  34. mode:
  35. type: string
  36. format:
  37. type: string
  38. footnote:
  39. type: string
  40. origin:
  41. type: string
  42. paragraph:
  43. type: string
  44. id:
  45. type: integer
  46. title:
  47. type: string
  48. description:
  49. type: string
  50. type:
  51. type: integer
  52. category:
  53. type: string
  54. progress:
  55. type: integer
  56. parent_id:
  57. type: integer
  58. parent:
  59. type: string
  60. roles:
  61. type: string
  62. executor_id:
  63. type: integer
  64. executor_relation_task_id:
  65. type: integer
  66. executor_relation_task:
  67. type: string
  68. pre_task:
  69. type: string
  70. next_task:
  71. type: string
  72. is_milestone:
  73. type: boolean
  74. project_id:
  75. type: integer
  76. project:
  77. type: string
  78. owner_id:
  79. type: integer
  80. owner:
  81. type: string
  82. editor_id:
  83. type: integer
  84. editor:
  85. type: string
  86. order:
  87. type: string
  88. status:
  89. type: integer
  90. created_at:
  91. type: string
  92. updated_at:
  93. type: string
  94. started_at:
  95. type: string
  96. finished_at:
  97. type: string
  98. assignees_id:
  99. type: integer
  100. assignees:
  101. type: string
  102. html:
  103. type: string
  104. executor:
  105. type: string
  106. 401:
  107. $ref: '../../main.yaml#/components/responses/Unauthorized'
  108. 422:
  109. $ref: '../../main.yaml#/components/responses/ValidationError'
  110. put:
  111. summary: 修改任务
  112. tags:
  113. - task
  114. operationId: put_api_v2_task_task_
  115. description: |-
  116. 局部更新:只更新请求体里出现的字段,未出现的字段保持不变。必须登录(否则 401);
  117. 只有任务拥有者、实际执行人或责任人之一可以修改,否则返回 403。
  118. 副作用:传 assignees_id 会先删除该任务全部责任人再整体重建;
  119. 传 pre_task_id / next_task_id 会整体重写任务的前置 / 后续关联关系。
  120. 每次保存都会把 editor_id 更新为当前用户。
  121. 实现:`TaskController@update`
  122. parameters:
  123. -
  124. name: task
  125. in: path
  126. required: true
  127. schema:
  128. type: string
  129. description: '任务 uuid'
  130. requestBody:
  131. required: false
  132. content:
  133. application/json:
  134. schema:
  135. type: object
  136. properties:
  137. title:
  138. type: string
  139. description: 任务标题
  140. description:
  141. type: string
  142. description: 任务描述(markdown)
  143. category:
  144. type: string
  145. description: '类别,如 翻译、审稿、百科'
  146. progress:
  147. type: integer
  148. description: 进度,0-100
  149. assignees_id:
  150. type: array
  151. description: '责任人 uid 数组,整体覆盖原有责任人;传空数组等于清空'
  152. roles:
  153. type: array
  154. description: '领取该任务所需的角色要求,存为 json'
  155. executor_id:
  156. type: string
  157. description: '实际执行人 uid'
  158. executor_relation_task_id:
  159. type: string
  160. description: '执行人关联任务 uuid,表示执行人与该任务保持一致'
  161. project_id:
  162. type: string
  163. description: '所属工程 uid'
  164. pre_task_id:
  165. type: string
  166. description: '前置任务 uuid,逗号分隔,整体覆盖原有前置关系'
  167. next_task_id:
  168. type: string
  169. description: '后续任务 uuid,逗号分隔,整体覆盖原有后续关系'
  170. is_milestone:
  171. type: boolean
  172. description: 是否为里程碑
  173. order:
  174. type: integer
  175. description: 拖拽排序顺序
  176. responses:
  177. 200:
  178. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  179. content:
  180. application/json:
  181. schema:
  182. type: object
  183. properties:
  184. ok:
  185. type: boolean
  186. message:
  187. type: string
  188. data:
  189. type: object
  190. properties:
  191. mode:
  192. type: string
  193. format:
  194. type: string
  195. footnote:
  196. type: string
  197. origin:
  198. type: string
  199. paragraph:
  200. type: string
  201. id:
  202. type: integer
  203. title:
  204. type: string
  205. description:
  206. type: string
  207. type:
  208. type: integer
  209. category:
  210. type: string
  211. progress:
  212. type: integer
  213. parent_id:
  214. type: integer
  215. parent:
  216. type: string
  217. roles:
  218. type: string
  219. executor_id:
  220. type: integer
  221. executor_relation_task_id:
  222. type: integer
  223. executor_relation_task:
  224. type: string
  225. pre_task:
  226. type: string
  227. next_task:
  228. type: string
  229. is_milestone:
  230. type: boolean
  231. project_id:
  232. type: integer
  233. project:
  234. type: string
  235. owner_id:
  236. type: integer
  237. owner:
  238. type: string
  239. editor_id:
  240. type: integer
  241. editor:
  242. type: string
  243. order:
  244. type: string
  245. status:
  246. type: integer
  247. created_at:
  248. type: string
  249. updated_at:
  250. type: string
  251. started_at:
  252. type: string
  253. finished_at:
  254. type: string
  255. assignees_id:
  256. type: integer
  257. assignees:
  258. type: string
  259. html:
  260. type: string
  261. executor:
  262. type: string
  263. 401:
  264. $ref: '../../main.yaml#/components/responses/Unauthorized'
  265. 422:
  266. $ref: '../../main.yaml#/components/responses/ValidationError'
  267. patch:
  268. summary: 修改任务
  269. tags:
  270. - task
  271. operationId: patch_api_v2_task_task_
  272. description: |-
  273. 局部更新:只更新请求体里出现的字段,未出现的字段保持不变。必须登录(否则 401);
  274. 只有任务拥有者、实际执行人或责任人之一可以修改,否则返回 403。
  275. 副作用:传 assignees_id 会先删除该任务全部责任人再整体重建;
  276. 传 pre_task_id / next_task_id 会整体重写任务的前置 / 后续关联关系。
  277. 每次保存都会把 editor_id 更新为当前用户。
  278. 实现:`TaskController@update`
  279. parameters:
  280. -
  281. name: task
  282. in: path
  283. required: true
  284. schema:
  285. type: string
  286. description: '任务 uuid'
  287. requestBody:
  288. required: false
  289. content:
  290. application/json:
  291. schema:
  292. type: object
  293. properties:
  294. title:
  295. type: string
  296. description: 任务标题
  297. description:
  298. type: string
  299. description: 任务描述(markdown)
  300. category:
  301. type: string
  302. description: '类别,如 翻译、审稿、百科'
  303. progress:
  304. type: integer
  305. description: 进度,0-100
  306. assignees_id:
  307. type: array
  308. description: '责任人 uid 数组,整体覆盖原有责任人;传空数组等于清空'
  309. roles:
  310. type: array
  311. description: '领取该任务所需的角色要求,存为 json'
  312. executor_id:
  313. type: string
  314. description: '实际执行人 uid'
  315. executor_relation_task_id:
  316. type: string
  317. description: '执行人关联任务 uuid,表示执行人与该任务保持一致'
  318. project_id:
  319. type: string
  320. description: '所属工程 uid'
  321. pre_task_id:
  322. type: string
  323. description: '前置任务 uuid,逗号分隔,整体覆盖原有前置关系'
  324. next_task_id:
  325. type: string
  326. description: '后续任务 uuid,逗号分隔,整体覆盖原有后续关系'
  327. is_milestone:
  328. type: boolean
  329. description: 是否为里程碑
  330. order:
  331. type: integer
  332. description: 拖拽排序顺序
  333. responses:
  334. 200:
  335. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  336. content:
  337. application/json:
  338. schema:
  339. type: object
  340. properties:
  341. ok:
  342. type: boolean
  343. message:
  344. type: string
  345. data:
  346. type: object
  347. properties:
  348. mode:
  349. type: string
  350. format:
  351. type: string
  352. footnote:
  353. type: string
  354. origin:
  355. type: string
  356. paragraph:
  357. type: string
  358. id:
  359. type: integer
  360. title:
  361. type: string
  362. description:
  363. type: string
  364. type:
  365. type: integer
  366. category:
  367. type: string
  368. progress:
  369. type: integer
  370. parent_id:
  371. type: integer
  372. parent:
  373. type: string
  374. roles:
  375. type: string
  376. executor_id:
  377. type: integer
  378. executor_relation_task_id:
  379. type: integer
  380. executor_relation_task:
  381. type: string
  382. pre_task:
  383. type: string
  384. next_task:
  385. type: string
  386. is_milestone:
  387. type: boolean
  388. project_id:
  389. type: integer
  390. project:
  391. type: string
  392. owner_id:
  393. type: integer
  394. owner:
  395. type: string
  396. editor_id:
  397. type: integer
  398. editor:
  399. type: string
  400. order:
  401. type: string
  402. status:
  403. type: integer
  404. created_at:
  405. type: string
  406. updated_at:
  407. type: string
  408. started_at:
  409. type: string
  410. finished_at:
  411. type: string
  412. assignees_id:
  413. type: integer
  414. assignees:
  415. type: string
  416. html:
  417. type: string
  418. executor:
  419. type: string
  420. 401:
  421. $ref: '../../main.yaml#/components/responses/Unauthorized'
  422. 422:
  423. $ref: '../../main.yaml#/components/responses/ValidationError'
  424. delete:
  425. summary: 删除任务
  426. tags:
  427. - task
  428. operationId: delete_api_v2_task_task_
  429. description: |-
  430. 必须登录(否则 401),且当前用户必须是任务拥有者,否则返回 403。
  431. 删除成功返回 ok,失败返回 500。
  432. 实现:`TaskController@destroy`
  433. parameters:
  434. -
  435. name: task
  436. in: path
  437. required: true
  438. schema:
  439. type: string
  440. description: '任务 uuid'
  441. responses:
  442. 200:
  443. description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
  444. content:
  445. application/json:
  446. schema:
  447. type: object
  448. properties:
  449. ok:
  450. type: boolean
  451. message:
  452. type: string
  453. data:
  454. type: object
  455. 401:
  456. $ref: '../../main.yaml#/components/responses/Unauthorized'
  457. 422:
  458. $ref: '../../main.yaml#/components/responses/ValidationError'