-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
878 lines (829 loc) · 26.9 KB
/
Copy pathopenapi.yaml
File metadata and controls
878 lines (829 loc) · 26.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
openapi: 3.1.0
info:
title: Task Manager API
version: 1.0.0
description: |
Backend APIs for Projects / Tasks / Members / Labels / Comments.
Auth is JWT (Redis-backed blacklist). All responses use a `{ data: ... }` envelope,
paginated lists add a `{ meta: { current_page, total, ... } }` object.
contact:
name: Lv Hui
url: https://github.com/coolert/task-manager
license:
name: MIT
url: https://opensource.org/license/mit
servers:
- url: http://{host}:{port}
description: Local development (Sail)
variables:
host:
default: 127.0.0.1
enum: [ 127.0.0.1, host.docker.internal ]
port:
default: '80'
enum: [ '80', '8080', '8000' ]
- url: https://api.task.coolerk.com
description: Production (Live API)
tags:
- name: Auth
description: JWT-based authentication (login, refresh, logout, me).
- name: Projects
description: CRUD and ownership transfer for projects.
- name: Project Members
description: Manage project membership and roles (owner/admin/member/viewer).
- name: Project Labels
description: Project-scoped labels (create/update/delete, list).
- name: Tasks
description: CRUD plus assign/claim within a project.
- name: Task Comments
description: Add comments to tasks.
- name: Task Labels
description: Attach/detach labels to tasks.
- name: System
description: Lightweight system endpoints for health and uptime checks.
security:
- bearerAuth: [] # default: all endpoints require JWT unless overridden per-path
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
Meta:
type: object
properties:
current_page: { type: integer, example: 1 }
total: { type: integer, example: 42 }
ApiError:
type: object
properties:
message: { type: string }
errors:
type: object
additionalProperties:
type: array
items: { type: string }
required: [message]
User:
type: object
properties:
id: { type: integer, example: 1 }
name: { type: string, example: "Tom" }
email: { type: string, format: email, example: "owner@example.com" }
avatar_url: { type: [string, 'null'] }
required: [id, name]
Project:
type: object
properties:
id: { type: integer, example: 10 }
name: { type: string, example: "My Project" }
description: { type: [string, 'null'] }
owner_id: { type: integer, example: 1 }
tasks_count: { type: integer, example: 3 }
created_at: { type: string, format: date-time }
updated_at: { type: string, format: date-time }
required: [id, name, owner_id]
ProjectMember:
type: object
properties:
id: { type: integer, example: 101 }
project_id: { type: integer, example: 10 }
user:
$ref: '#/components/schemas/User'
role:
type: string
enum: [owner, admin, member, viewer]
example: member
required: [id, project_id, user, role]
Label:
type: object
properties:
id: { type: integer, example: 7 }
project_id: { type: integer, example: 10 }
name: { type: string, example: "Bug" }
color: { type: string, example: "#ff0000" }
created_at: { type: string, format: date-time }
updated_at: { type: string, format: date-time }
required: [id, project_id, name, color]
Task:
type: object
properties:
id: { type: integer, example: 55 }
project_id: { type: integer, example: 10 }
title: { type: string, example: "Implement Redis blacklist" }
description: { type: [string, 'null'] }
status:
type: string
enum: [todo, doing, done]
example: todo
priority:
type: string
enum: [low, normal, high]
example: normal
assignee:
oneOf:
- $ref: '#/components/schemas/User'
- type: 'null'
creator:
$ref: '#/components/schemas/User'
labels:
type: array
items:
$ref: '#/components/schemas/Label'
created_at: { type: string, format: date-time }
updated_at: { type: string, format: date-time }
required: [id, project_id, title, status, priority, creator]
TaskComment:
type: object
properties:
id: { type: integer, example: 999 }
task_id: { type: integer, example: 55 }
user:
$ref: '#/components/schemas/User'
content: { type: string, example: "hello" }
created_at: { type: string, format: date-time }
updated_at: { type: string, format: date-time }
required: [id, task_id, user, content]
EnvelopeProject:
type: object
properties:
data: { $ref: '#/components/schemas/Project' }
required: [data]
EnvelopeProjectList:
type: object
properties:
data:
type: array
items: { $ref: '#/components/schemas/Project' }
meta: { $ref: '#/components/schemas/Meta' }
required: [data]
EnvelopeTask:
type: object
properties:
data: { $ref: '#/components/schemas/Task' }
required: [data]
EnvelopeTaskList:
type: object
properties:
data:
type: array
items: { $ref: '#/components/schemas/Task' }
meta: { $ref: '#/components/schemas/Meta' }
required: [data]
EnvelopeMemberList:
type: object
properties:
data:
type: array
items: { $ref: '#/components/schemas/ProjectMember' }
required: [data]
EnvelopeLabel:
type: object
properties:
data: { $ref: '#/components/schemas/Label' }
required: [data]
EnvelopeLabelList:
type: object
properties:
data:
type: array
items: { $ref: '#/components/schemas/Label' }
required: [data]
EnvelopeComment:
type: object
properties:
data: { $ref: '#/components/schemas/TaskComment' }
required: [data]
paths:
/api/auth/register:
post:
operationId: auth_register
tags: [Auth]
security: []
summary: Register a new user
description: Create a new user account and automatically return a JWT access token.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name: { type: string, example: John Doe }
email: { type: string, format: email, example: john@example.com }
password: { type: string, format: password, minLength: 8, example: password123 }
password_confirmation: { type: string, format: password, minLength: 8, example: password123 }
required: [ name, email, password, password_confirmation ]
responses:
'201':
description: User registered successfully
content:
application/json:
schema:
type: object
properties:
token: { type: string }
token_type: { type: string, example: Bearer }
expires_in: { type: integer, example: 3600 }
user: { $ref: '#/components/schemas/User' }
'422':
description: Validation error
content:
application/json:
schema: { $ref: '#/components/schemas/ApiError' }
/api/auth/login:
post:
operationId: auth_login
tags: [Auth]
security: []
summary: Login and obtain JWT token
description: Issue a short-lived JWT for valid credentials; returns token, type, and expiry.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
email: { type: string, format: email }
password: { type: string, format: password }
required: [email, password]
examples:
demo:
value: { email: "owner@example.com", password: "password" }
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
token: { type: string }
token_type: { type: string, example: "Bearer" }
expires_in: { type: integer, example: 3600 }
'422':
description: Validation error
content:
application/json:
schema: { $ref: '#/components/schemas/ApiError' }
'401':
description: Invalid credentials
/api/auth/me:
get:
operationId: auth_me
tags: [Auth]
summary: Get current authenticated user
description: Return the currently authenticated user’s basic profile.
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/User'
'401':
description: Unauthorized
/api/auth/refresh:
post:
operationId: auth_refresh
tags: [Auth]
summary: Refresh JWT token
description: Refresh the current JWT and return a new token with updated expiry.
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
token: { type: string }
token_type: { type: string, example: "Bearer" }
expires_in: { type: integer, example: 3600 }
'401':
description: Unauthorized
/api/auth/logout:
post:
operationId: auth_logout
tags: [Auth]
summary: Logout and blacklist JWT
description: Invalidate the current JWT via Redis blacklist to immediately revoke access.
responses:
'204':
description: No Content
'401':
description: Unauthorized
/api/projects:
get:
operationId: projects_index
tags: [Projects]
summary: List projects I own or joined
description: List projects the user owns or has joined (paginated).
responses:
'200':
description: OK
content:
application/json:
schema: { $ref: '#/components/schemas/EnvelopeProjectList' }
'401':
description: Unauthorized
'403':
description: Forbidden
post:
operationId: projects_store
tags: [Projects]
summary: Create project
description: Create a new project as the authenticated user (becomes Owner).
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name: { type: string, maxLength: 120 }
description: { type: [string, 'null'] }
required: [name]
responses:
'201':
description: Created
content:
application/json:
schema: { $ref: '#/components/schemas/EnvelopeProject' }
'422':
description: Validation error
content:
application/json:
schema: { $ref: '#/components/schemas/ApiError' }
/api/projects/{project}:
parameters:
- name: project
in: path
required: true
schema: { type: integer }
get:
operationId: projects_show
tags: [Projects]
summary: Show project (member required)
description: Show project details; requires membership in the project.
responses:
'200':
description: OK
content:
application/json:
schema: { $ref: '#/components/schemas/EnvelopeProject' }
'403':
description: Forbidden
'404':
description: Not Found
patch:
operationId: projects_update
tags: [Projects]
summary: Update project (owner/admin)
description: Update project metadata; allowed for Owner and Admin.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name: { type: string, maxLength: 120}
description: { type: [string, 'null'] }
responses:
'200':
description: OK
content:
application/json:
schema: { $ref: '#/components/schemas/EnvelopeProject' }
'403': { description: Forbidden }
'404': { description: Not Found }
'422':
description: Validation error
content:
application/json:
schema: { $ref: '#/components/schemas/ApiError' }
delete:
operationId: projects_destroy
tags: [Projects]
summary: Delete project (owner only, soft delete)
description: Soft-delete a project; allowed for Owner only.
responses:
'204': { description: No Content }
'403': { description: Forbidden }
'404': { description: Not Found }
/api/projects/{project}/owner:
parameters:
- name: project
in: path
required: true
schema: { type: integer }
post:
operationId: projects_transfer_ownership
tags: [Projects]
summary: Transfer ownership (owner only, new owner must be a member)
description: Transfer project ownership to an existing Admin member.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
new_owner_id: { type: integer }
required: [new_owner_id]
responses:
'200': { description: OK }
'403': { description: Forbidden }
'404': { description: Not Found }
'422': { description: Unprocessable Entity }
/api/projects/{project}/members:
parameters:
- name: project
in: path
required: true
schema: { type: integer }
get:
operationId: project_members_index
tags: [Project Members]
summary: List project members (owner/admin)
description: List project members and their roles; Owner/Admin only.
responses:
'200':
description: OK
content:
application/json:
schema: { $ref: '#/components/schemas/EnvelopeMemberList' }
'403': { description: Forbidden }
'404': { description: Not Found }
post:
operationId: project_members_store
tags: [Project Members]
summary: Add project member (owner/admin)
description: Add a user to the project with a specific role; Owner/Admin only.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
user_id: { type: integer }
role:
type: string
enum: [admin, member, viewer]
required: [user_id, role]
responses:
'201': { description: Created }
'403': { description: Forbidden }
'404': { description: Not Found }
'422': { description: Unprocessable Entity }
/api/projects/{project}/members/{project_member}:
parameters:
- name: project
in: path
required: true
schema: { type: integer }
- name: project_member
in: path
required: true
schema: { type: integer }
patch:
operationId: project_members_update
tags: [Project Members]
summary: Update member role (owner/admin)
description: Change a member’s role (e.g., Member → Admin); Owner/Admin only.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
role:
type: string
enum: [admin, member, viewer]
required: [role]
responses:
'200': { description: OK }
'403': { description: Forbidden }
'404': { description: Not Found }
'422': { description: Unprocessable Entity }
delete:
operationId: project_members_destroy
tags: [Project Members]
summary: Remove member (owner/admin; cannot delete Owner)
description: Remove a member from the project; Owner/Admin only.
responses:
'204': { description: No Content }
'403': { description: Forbidden }
'404': { description: Not Found }
'422': { description: Unprocessable Entity }
/api/projects/{project}/labels:
parameters:
- name: project
in: path
required: true
schema: { type: integer }
get:
operationId: project_labels_index
tags: [Project Labels]
summary: List labels (project member)
description: List labels scoped to this project.
responses:
'200':
description: OK
content:
application/json:
schema: { $ref: '#/components/schemas/EnvelopeLabelList' }
'403': { description: Forbidden }
'404': { description: Not Found }
post:
operationId: project_labels_store
tags: [Project Labels]
summary: Create label (owner/admin)
description: Create a new label in this project; Owner/Admin only.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name: { type: string, maxLength: 40 }
color: { type: string, maxLength: 16 , example: "#00ff00" }
required: [name, color]
responses:
'201':
description: Created
content:
application/json:
schema: { $ref: '#/components/schemas/EnvelopeLabel'}
'403': { description: Forbidden }
'404': { description: Not Found }
'422': { description: Unprocessable Entity }
/api/projects/{project}/labels/{label}:
parameters:
- name: project
in: path
required: true
schema: { type: integer }
- name: label
in: path
required: true
schema: { type: integer }
patch:
operationId: project_labels_update
tags: [Project Labels]
summary: Update label (owner/admin)
description: Rename or update a project label; Owner/Admin only.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name: { type: string, maxLength: 40 }
color: { type: string, maxLength: 16 }
responses:
'200':
description: OK
content:
application/json:
schema: { $ref: '#/components/schemas/EnvelopeLabel' }
'403': { description: Forbidden }
'404': { description: Not Found }
'422': { description: Unprocessable Entity }
delete:
operationId: project_labels_destroy
tags: [Project Labels]
summary: Delete label (owner/admin; 409 if label used by any task)
description: Delete a project label; Owner/Admin only.
responses:
'204': { description: No Content }
'403': { description: Forbidden }
'404': { description: Not Found }
'409': { description: Conflict }
/api/projects/{project}/tasks:
parameters:
- name: project
in: path
required: true
schema: { type: integer }
get:
operationId: project_tasks_index
tags: [Tasks]
summary: List tasks (project member; paginated)
description: List tasks in the project (member access; paginated).
responses:
'200':
description: OK
content:
application/json:
schema: { $ref: '#/components/schemas/EnvelopeTaskList' }
'401':
description: Unauthorized
'403':
description: Forbidden
post:
operationId: project_tasks_store
tags: [Tasks]
summary: Create task (owner/admin/member)
description: Create a task in the project; requires Member or higher.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
title: { type: string, maxLength: 150 }
description: { type: [string, 'null'] }
assignee_id: { type: [integer, 'null'], description: "Non-viewer member of this project" }
status: { type: string, enum: [todo, doing, done] }
priority: { type: string, enum: [low, normal, high] }
due_date: { type: [string, 'null'], format: date }
order_no: { type: [integer, 'null'] }
required: [title, status, priority]
responses:
'201':
description: Created
content:
application/json:
schema: { $ref: '#/components/schemas/EnvelopeTask' }
'403': { description: Forbidden }
'404': { description: Not Found }
'422': { description: Unprocessable Entity }
/api/tasks/{task}:
parameters:
- name: task
in: path
required: true
schema: { type: integer }
get:
operationId: tasks_show
tags: [Tasks]
summary: Show task (project member)
description: Show task details; requires membership in the owning project.
responses:
'200':
description: OK
content:
application/json:
schema: { $ref: '#/components/schemas/EnvelopeTask' }
'403': { description: Forbidden }
'404': { description: Not Found }
patch:
operationId: tasks_update
tags: [Tasks]
summary: Update task (owner/admin/creator/assignee; assignee_id cannot be changed here)
description: Update a task; allowed for Owner/Admin, creator, or current assignee.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
title: { type: string, maxLength: 150 }
description: { type: [string, 'null'] }
status: { type: string, enum: [todo, doing, done] }
priority: { type: string, enum: [low, normal, high] }
due_date: { type: [string, 'null'], format: date }
order_no: { type: [integer, 'null'] }
responses:
'200': { description: OK }
'403': { description: Forbidden }
'404': { description: Not Found }
'422': { description: Unprocessable Entity }
delete:
operationId: tasks_destroy
tags: [Tasks]
summary: Delete task (owner/admin/creator)
description: Delete a task; allowed for Owner/Admin or the task creator.
responses:
'204': { description: No Content }
'403': { description: Forbidden }
'404': { description: Not Found }
/api/tasks/{task}/assign:
parameters:
- name: task
in: path
required: true
schema: { type: integer }
post:
operationId: tasks_assign
tags: [Tasks]
summary: Assign task (owner/admin; assignee must be non-viewer member)
description: Assign the task to a non-viewer project member; Owner/Admin only.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
assignee_id: { type: integer }
required: [assignee_id]
responses:
'200': { description: OK }
'403': { description: Forbidden }
'404': { description: Not Found }
'422': { description: Unprocessable Entity }
/api/tasks/{task}/claim:
parameters:
- name: task
in: path
required: true
schema: { type: integer }
post:
operationId: tasks_claim
tags: [Tasks]
summary: Claim task (owner/admin/member; only when unassigned)
description: Claim an unassigned task for the current user (Member or higher).
responses:
'200': { description: OK }
'403': { description: Forbidden }
'404': { description: Not Found }
/api/tasks/{task}/comments:
parameters:
- name: task
in: path
required: true
schema: { type: integer }
post:
operationId: task_comments_store
tags: [Task Comments]
summary: Add a comment (project member)
description: Add a comment to the task; requires membership in the project.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
content: { type: string }
required: [content]
responses:
'201':
description: Created
content:
application/json:
schema: { $ref: '#/components/schemas/EnvelopeComment' }
'403': { description: Forbidden }
'404': { description: Not Found }
'422': { description: Unprocessable Entity }
/api/tasks/{task}/labels/{label}:
parameters:
- name: task
in: path
required: true
schema: { type: integer }
- name: label
in: path
required: true
schema: { type: integer }
post:
operationId: task_labels_attach
tags: [Task Labels]
summary: Attach label (same project only; idempotent)
description: Attach a project-scoped label to the task; membership required.
responses:
'200': { description: OK }
'403': { description: Forbidden }
'404': { description: Not Found }
'409': { description: Conflict (cross-project) }
delete:
operationId: task_labels_detach
tags: [Task Labels]
summary: Detach label (idempotent)
description: Detach a project-scoped label from the task; membership required.
responses:
'204': { description: No Content }
'403': { description: Forbidden }
'404': { description: Not Found }
'409': { description: Conflict (cross-project) }
/api/health:
get:
operationId: health_check
tags: [System]
security: []
summary: Health check endpoint
description: Lightweight health probe used by load balancers, uptime monitoring and deployment checks. Does not touch external dependencies and always returns quickly.
responses:
'200':
description: Service is healthy
content:
application/json:
schema:
type: object
properties:
status: { type: string, example: ok }
timestamp: { type: string, format: date-time, example: 2025-12-08T12:34:56Z }